https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97567
Bug ID: 97567 Summary: wrong code at -Os and above on x86_64-pc-linux-gnu Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- [550] % gcctk -v Using built-in specs. COLLECT_GCC=gcctk COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --disable-bootstrap --prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++ --disable-werror --enable-multilib --with-system-zlib Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.0.0 20201025 (experimental) [master revision 1aeb7d7d67d:7a48d67add1:d7ddd287ca76e87f431f43687de6d8cc48e52543] (GCC) [551] % [551] % gcctk -O1 small.c; ./a.out [552] % [552] % gcctk -Os small.c [553] % ./a.out Illegal instruction [554] % [554] % cat small.c int a, b, c, d; void k() { unsigned f = 1; long g = 4073709551615; for (; a; a++) for (;;) { d = 0; L1: break; } if (f) for (; a; a++) ; g || f; int i = 0 - f || g; long j = g - f; if (j || f) { if (g < 4073709551615) for (;;) ; int e = ~f, h = b / ~e; if (c) goto L2; g = f = h; } g || d; L2: if (c) goto L1; } int main() { k(); return 0; }