This is the mail archive of the
mailing list for the GCC project.
Re: Volatile MEMs in statement expressions and functions inlined as trees
On 13-Dec-2001, Linus Torvalds <firstname.lastname@example.org> wrote:
> For an expression like
> extern volatile in p;
> you would expect to see the assembly code to contain a dereference of "p",
> would you not?
No. I wouldn't know what to expect.
> And that expected behaviour is indeed what gcc will do.
I just tried two other compilers (lcc 4.1 on Linux, and cc on SunOS 5.7)
and neither of them generated a dereference of "p".
It would be nicer IMHO if gcc warned that this code was non-portable.
I much prefer lcc's response:
x.c:4: warning: reference to `volatile int' elided
x.c:4: warning: expression with no effect elided
Fergus Henderson <email@example.com> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.