This is the mail archive of the
mailing list for the GCC project.
Re: Testcase for strict-aliasing wanted
- From: Osku Salerma <osku at iki dot fi>
- To: Geoff Keating <geoffk at geoffk dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Sat, 19 Jan 2002 14:04:09 +0200 (EET)
- Subject: Re: Testcase for strict-aliasing wanted
On 18 Jan 2002, Geoff Keating wrote:
> Osku Salerma <firstname.lastname@example.org> 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 - email@example.com - http://www.iki.fi/osku/
Information wants to be free.