http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47409
Summary: volatile struct member bug Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: reg...@cs.utah.edu The load/store shouldn't go away (especially at -O0). regehr@home:~$ current-gcc -O0 vol.c -S -o - foo: pushl %ebp movl %esp, %ebp popl %ebp ret regehr@home:~$ cat small.c const volatile int g_2 = 1; int g_1 = 0; void func_1 (void) { g_1 = g_2; } int main (void) { g_1 = g_2; return 0; } regehr@home:~$ current-gcc -v Using built-in specs. COLLECT_GCC=current-gcc COLLECT_LTO_WRAPPER=/mnt/z/z/compiler-install/gcc-r169118-install/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../configure --with-libelf=/usr/local --enable-lto --prefix=/mnt/z/z/compiler-install/gcc-r169118-install --program-prefix=r169118- --enable-languages=c,c++ Thread model: posix gcc version 4.6.0 20110122 (experimental) (GCC)