Created attachment 504181 [details] gzip'd intermediate file. Description of problem: 4.6.0 with -O2 incorrectly optimizes code of the following form: struct foo fooTmp; struct foo *fooPtr = &fooTmp; ... expression involving fooPtr->fld fooTmp.fld += something; same expression involving fooPtr->fld The generated code assumes that the value fetched through fooPtr is still good after the update to the referenced variable. The same code has worked fine in all previous gcc versions (it's out of postgresql FWIW) Version-Release number of selected component (if applicable): gcc-4.6.0-9.fc15.x86_64 How reproducible: 100% Steps to Reproduce: 1. Compile with /usr/bin/gcc -O2 -fno-strict-aliasing -fwrapv -g -I../../../../src/include -D_GNU_SOURCE -c xlog.c 2. Inspect code for lines 3772, 3780, 3798 Additional info: Unsurprisingly, -fno-gcse makes the bug go away. I attach the .i file for the source code.
I've so far distilled a small self-contained testcase from this, tracking upstream.