Howard Chu <[EMAIL PROTECTED]> writes:

> I understand that logic, in the general case. In this specific example,
> none of those conditions apply. foo is an uninitialized local
> variable. Therefore the compiler cannot know that it has a valid copy of
> it in any register. In fact what it should know is that it has no valid
> copy of it. And of course, there are no loops to consider here, so that
> type of reload optimization isn't relevant. As such, the compiler has no
> choice but to do the right thing, and load the value from memory, thus
> getting the correct result. Which it does.

It will load the value from memory, true, but who says that the store to
memory will happen before that?  The compiler is allowed to reorder the
statements since it "knows" that foo and *arg cannot alias.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

Reply via email to