This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcc optimises out test of value in register-only loop
Andrew Haley <aph <at> redhat.com> writes:
>
> On 10/13/2011 12:56 PM, MikeW wrote:
> >
> > Looks like the 'volatile' attribute does not work when registers
are involved,
> > even though various language standard documents just mention "access to
> > an object" rather than stating that the qualifier only applies to
> > in-memory "objects".
>
> Indeed, and nowhere does it state what constitutes an access.
Besides, named
> register variables is a gcc extension.
>
> > The generated code would imply:
> >
> > if (stop_loop != 0) {
> > while (1);
> > }
> >
> > which is not equivalent to my source !
>
> That's true. Maybe we should simply make this case generate a warning.
> It doesn't make sense on any level, really.
>
> Andrew.
>
>
I would certainly like there to be some way to ensure that an
expression in a loop gets (re) evaluated, in a 'volatile' context.
gmane padding..............................
gmane padding..............................