volatile semantics

Giovanni Bajo giovannibajo@libero.it
Tue May 3 09:53:00 GMT 2005


Mike Stump <mrs@apple.com> wrote:

> int avail;
> int main() {
>    while (*(volatile int *)&avail == 0)
>      continue;
>    return 0;
> }
>
>
> Ok, so, the question is, should gcc produce code that infinitely
> loops, or should it be obligated to actually fetch from memory?
> Hint, 3.3 fetched.


I agree it should fetch. Did you try -fno-strict-aliasing? Open a bugreport,
I'd say.

Giovanni Bajo



More information about the Gcc mailing list