This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Volatile MEMs in statement expressions and functions inlined astrees



On Thu, 13 Dec 2001, Richard Henderson wrote:
> On Thu, Dec 13, 2001 at 01:54:11PM -0800, Linus Torvalds wrote:
> > You misunderstand.
> >
> > A plain "p = 0;" assignment does _not_ load anything from memory...
>
> Actually I don't misunderstand.  GCC _will_ do this iff that statement
> appears in an inlined function.  That is the bug that was originally
> reported.  I think aoliva has fixed this now, but I can't remember.

Oh, wow.  Psychedelic.

That is even more inconsistent than I imagined. I had to actually test it
out before I believed you.

I cannot imagine that anybody can seriously argue for that kind of
terminal illness of the compiler..

> I'm still stuck on the existence of a sequence point internal to
> operator= (mentioned by Jason earlier), the fact that the expression
> is an lvalue, and the fact that reading from p may not yield the 0
> that was previously stored.

Yes, reading from "p" may yield something totally different.

Which is, again, why I point to the oft-quoted sentence, which says that
the assignment returns the value stored. Which, as you say, is _not_ the
same as the value we might read back.

Note that the sequence point implied by the "=" does not matter in the
least, if you accept that the _expression_ "p = 0" has a value quite
independently of "p".

		Linus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]