https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120044
Bug ID: 120044 Summary: wrong code at -O1 and above with "-fno-early-inlining -fno-tree-fre -fno-tree-pre -fno-code-hoisting" on x86_64-linux-gnu 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: --- Compiler Explorer: https://godbolt.org/z/jK8rG558r It appears to be a latent issue and affects 12.1 and later. [535] % 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/16.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --disable-bootstrap --enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk --enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 16.0.0 20250430 (experimental) (GCC) [536] % [536] % gcctk -O3 small.c; ./a.out [537] % [537] % gcctk -O3 -fno-early-inlining -fno-tree-fre -fno-tree-pre -fno-code-hoisting small.c [538] % ./a.out Segmentation fault [539] % [539] % cat small.c struct a { int b; } const c; void d(char p, struct a e) { while (e.b) ; } static unsigned short f(const struct a g) { d(g.b, g); return g.b; } int main() { f(c); }