http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48124
Summary: likely wrong code bug Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: reg...@cs.utah.edu [regehr@gamow ~]$ current-gcc -v Using built-in specs. COLLECT_GCC=current-gcc COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r170949-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --with-libelf=/usr/local --enable-lto --prefix=/home/regehr/z/compiler-install/gcc-r170949-install --program-prefix=r170949- --enable-languages=c,c++ Thread model: posix gcc version 4.7.0 20110314 (experimental) (GCC) [regehr@gamow ~]$ current-gcc -O1 small.c -o small [regehr@gamow ~]$ ./small g_1 = 2 [regehr@gamow ~]$ current-gcc -Os small.c -o small [regehr@gamow ~]$ ./small g_1 = 1 [regehr@gamow ~]$ cat small.c struct S0 { signed f0 : 26; signed f1 : 16; signed f2 : 10; volatile signed f3 : 14; }; static int g_1 = 1; static struct S0 g_2 = {0,0,0,1}; int printf(const char *format, ...); void func_1(void) { g_2.f3 = 0; g_1 = 2; } int main (int argc, char* argv[]) { func_1(); printf("g_1 = %d\n", g_1); return 0; }