https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100188
Bug ID: 100188 Summary: missed optimization for dead code elimination at -O3 (vs. -O1) 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: --- [529] % 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 20210421 (experimental) [master revision 7f9b7ccf0c1:344da81f015:5445da1a94bb4df752209e54f4aa21702609a20a] (GCC) [530] % [530] % gcctk -O1 -S -o O1.s small.c [531] % gcctk -O3 -S -o O3.s small.c [532] % [532] % wc O1.s O3.s 14 31 324 O1.s 35 72 615 O3.s 49 103 939 total [533] % [533] % grep foo O1.s [534] % grep foo O3.s jmp foo [535] % [535] % cat small.c extern void foo(void); static int b = 1, c, *f; static int a() { return 0; } static void d(int j) { int g, *h[36] = {&g, &g}, **i[1] = {&h[0]}; if (!j) { c = 0; foo(); } } int main() { int k[8]; d(b); if (a()) f = &k[0]; return 0; }