https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111572
Bug ID: 111572 Summary: Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: shaohua.li at inf dot ethz.ch CC: jh at suse dot cz Target Milestone: --- gcc at -O2 produces the wrong code. Bisected to r14-301-gf2d6beb7a4d Compiler explorer: https://godbolt.org/z/reETd3ee4 $ cat a.c int printf(const char *, ...); int a, b = -8, e, f, h; char c, d, g; static int i(long k) { e = 8; for (; e; e = f) { d = 6; for (; d<7; d++) { unsigned char j = 0; for (; (unsigned char)(1 + k) + j <= 3; j++) printf("%u\n", (unsigned char)(1 + k) + j); } for (; g; g++) ; } return 0; } int main() { h = 26 & b; i((short)(h - 65557) + 65535); } $ $ gcc -O0 a.c && ./a.out 3 $ gcc -O2 a.c && ./a.out 3 3 3 3 (Truncated) $