From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2004-10-01 04:32:07


Peter Dimov wrote:
[...]
> >> write volatile @a 1
> >
> > nop
> >
> >> read volatile @a x
> >
> > nop
> >
> >> write volatile @a x-1
> >
> > nop
> >
> >> exit(x-1)
> >
> > push 0
> > call _exit
> >
> >>
> >> in the first case, and
> >
> > Happy now (debugger notwithstanding)?
>
> No. A conforming compiler is not allowed to do that.

I see no reason why. It translated your accesses to a sequence of nop
instructions.

>
> > C'mon, volatile is brain-dead.
>
> Nobody's arguing otherwise. ;-) But a nop it isn't.

Nop works just fine for your volatile accesses. You can't prove non-
conformance without trying to fool the program using debugger (or
things like that... beyond the scope of the standard). Innocent until
proven guilty, you know.

regards,
alexander.