https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86066
Bug ID: 86066 Summary: wrong code at -Os and above 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: su at cs dot ucdavis.edu Target Milestone: --- This appears to be a recent regression. $ gcctk -v Using built-in specs. COLLECT_GCC=gcctk COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap Thread model: posix gcc version 9.0.0 20180606 (experimental) [trunk revision 261226] (GCC) $ $ gcctk -O1 small.c; ./a.out $ $ gcctk -Os small.c $ timeout -s 9 5 ./a.out Killed $ -------------------------------- struct A { int b:2; int c:2; unsigned d:8; }; int main () { struct A t = { 0, 0, 2 }; L: t.d = ~(~(~0 % t.d) % 2); if (!t.d) goto L; return 0; }