This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Volatile qualification on pointer and data


"Paulo J. Matos" <paulo@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]