On Jan 26, 2006, Richard Guenther <[EMAIL PROTECTED]> wrote:

>> So it is perfectly valid, but if GCC reorders the read from *ip past
>> the store to *dp, it turns the valid program into one that misbehaves.

> *ip = 15; ii = *ip; *dp = 1.5; dd = *dp;
> Here                    ^^^
> you are accessing memory of type integer as type double.

Yes, but that's not what the Standard defines as undefined.  If the
stored value is accessed with a type that differs from the effective
type, then you lose.  But here it's not accessing the stored type;
quite the contrary, it's overwriting it, giving the underlying memory
a new effective type.  Please read 6.5/6-7.

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   [EMAIL PROTECTED], gcc.gnu.org}
Free Software Evangelist  [EMAIL PROTECTED], gnu.org}

Reply via email to