Volatile const members of a struct are not generating a load when read while volatile non-const members are loaded (volatile const objects outside of a structure do generate a load when read). const members of a volatile struct generate two loads when read (strange code being produced in this case). This has been seen in 3.3.3 (for x86 and m68k targets) and 3.4.4 (for m68k targets, untested on x86). The attached test.cpp file when compiled gcc -c -save-temps test.cpp on 3.3.3 under cygwin (x86 target) produces the attached test.s output. Multiple stores on volatile const members of structs get optimized away as well (this is not demonstrated in the attached test code). Note that when the test code is compiled as C rather than C++, correct code gets produced.
Created attachment 9652 [details] Test code
Created attachment 9653 [details] Sample compiled output for test code This sample was compiled: gcc -c -save-temps test.cpp on rev 3.3.3 under Cygwin
Test using i686-pc-cygwin with revision 4.0.1 shows problem resolved and good code being emitted (although two new warnings are output about non-local anonymous variables).
gcc 3.3 has not been maintained for a long time. Since you say that gcc 4.0 fixes the bug, I think we can close the bug. W.