This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Testcase for strict-aliasing wanted


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]