"Paulo J. Matos" <pa...@matos-sorge.com> writes: > The following code: > static const unsigned int foo = 1; > unsigned int test( void ) > { > const volatile unsigned int *bar = &foo; > return ( *bar ); > } > > in GCC45 works as expected: > $test: > ld AL,#foo ;; AL is return register > bra 0,X ;; end function > > in GCC46: > $test: > ld AL,0 > bra 0,X > > This is worrying because qualifying the data as volatile should be > enough to prevent these sort of optimizations. It did until GCC46.
I agree that this looks like a bug. Please file a bug report marked as a regression. Ian