volatile function

Jonathan Wakely jwakely.gcc@gmail.com
Tue Jan 25 09:24:00 GMT 2011


On 25 January 2011 08:04, kevin diggs wrote:
> Hi,
>
> The function in question is returning the value of the PLL config
> register in a PowerPC 750GX. I wanted to make sure that the optimizer
> does not move or eliminate the call. I thought that is one of the uses
> of the volatile qualifier???

But your qualifier is on the return type, not the function.  If that
had any meaning, it would force the compiler to read the return value,
not actually make the call.  But the return value is always read once,
when the call is made.

Is the optimizer actually doing anything wrong, or are you trying to
solve a problem that doesn't exist?



More information about the Gcc-help mailing list