Sorry to mention aliasing again, but is the standard IN6_ARE_ADDR_EQUAL really wrong?
Andreas Schwab
schwab@linux-m68k.org
Sun Jan 10 10:30:00 GMT 2010
Dave Korn <dave.korn.cygwin@googlemail.com> writes:
> Is that really right? The type of the pointer (in6->__s6_addr) that we're
> casting is unsigned char *, so shouldn't it already alias everything anyway
> and dereferencing it be allowed, like it is for the casted (a)? I'll file a
> PR if so. (I can't pretend I find the language in the spec easy to follow.)
IIUC both accesses are actually wrong, but in the case of a there is no
information about the actual target type, so the compiler cannot
optimize. In both cases an object is accessed as type uint32_t, but the
effective type is different. Aliasing is not symmetric, the aliasing
exception only applies to the case of accessing through a character
type, the effective type of the object does not matter.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Gcc
mailing list