https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100453
Bug ID: 100453 Summary: wrong code at -O1 and above Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zhendong.su at inf dot ethz.ch Target Milestone: --- It seems to be a recent regression. [513] % 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/12.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 12.0.0 20210506 (experimental) [master revision 1698f496c5e:27b373b33d4:a1ac9ffb5a7f44b2e2633b7265c21ce803c8e854] (GCC) [514] % [514] % gcctk -O0 small.c; ./a.out [515] % gcc110 -O1 small.c; ./a.out [516] % [516] % gcctk -O1 small.c [517] % ./a.out Segmentation fault [518] % [518] % cat small.c struct a { int b : 4; } d; static int c, e; static const struct a f; static void g(const struct a h) { for (; c < 1; c++) d = h; e = h.b; c = h.b; } int main() { g(f); return 0; }