https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111583
Bug ID: 111583 Summary: [13/14 Regression] Wrong code at -Os on x86_64-linux-gnu since r13-3281-g6cc3394507 Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: shaohua.li at inf dot ethz.ch CC: amacleod at redhat dot com Target Milestone: --- gcc at -Os produced the wrong code. Bisected to r13-3281-g6cc3394507 Compiler explorer: https://godbolt.org/z/8GM9YvMKb $ cat a.c int printf(const char *, ...); int b, c, d; char e; short f; const unsigned short **g; char h(char k) { if (k) return '0'; return 0; } int l() { b = 0; return 1; } static short m(unsigned k) { const unsigned short *n[65]; g = &n[4]; k || l(); long a = k; char i = 0; unsigned long j = k; while (j--) *(char *)a++ = i; c = h(d); f = k; return 0; } int main() { long o = (e < 0) << 5; m(o); printf("%d\n", f); } $ $ gcc -O0 -fsanitize=address,undefined a.c && ./a.out 0 $ gcc -Os a.c && ./a.out 32 $