http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59857
--- Comment #2 from Richard Earnshaw <rearnsha at gcc dot gnu.org> --- My suspicion is that ulv is short-hand for unsigned long volatile -- since without it this testcase is completely degenerate: val isn't used at all, so when ulv is not volatile, then entire function reduces to 'return 10;' The difference between the output when ulv is volatile is then down to no-longer using post-increment operations on volatile memory accesses. I suspect this was done to fix problems we've had with incorrect optimizations of volatile operations. I think we've seen similar bug reports to this in the past. GCC is *very* conservative when dealing with volatile objects, so I'm not surprised we don't do this optimization.