https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82078
Bug ID: 82078 Summary: wrong code at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com Target Milestone: --- $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 8.0.0 20170901 (experimental) [trunk revision 251580] (GCC) $ gcc-trunk -O3 small.c ; ./a.out 2 $ gcc-trunk -O0 small.c ; ./a.out 0 $ cat small.c int printf(const char *, ...); struct S0 { signed f4; signed f9 : 5; } a[6][5], b = {2} ; int c, d; int fn1() { struct S0 e[5][5]; struct S0 f; b = f = e[2][5] = a[5][0]; if (d) ; else return f.f9; e[c][45] = a[4][4]; } int main() { fn1(); printf("%d\n", b.f4); return 0; } $