Testcase for strict-aliasing wanted
Osku Salerma
osku@iki.fi
Sat Jan 19 13:17:00 GMT 2002
On 18 Jan 2002, Geoff Keating wrote:
> Osku Salerma <osku@iki.fi> writes:
> > [invalid test case]
>
> `char' is a special case; ISO C requires that it be allowed to alias
> with anything. Try the same testcase with `short' instead of `char'.
Yep, it works as expected with 'char' changed to 'short'. I did know
about the fact that char can alias anything, but for some reason I
kept thinking that since I was accessing "char data" through an int
pointer, the compiler would be free to assume such things wouldn't
happen. Totally wrong, of course, for several reasons.
Thanks for the help.
--
Osku Salerma - osku@iki.fi - http://www.iki.fi/osku/
Information wants to be free.
More information about the Gcc
mailing list