Possible egcs-980115 bug handling pointer casts

Jason Merrill jason@cygnus.com
Sun Jan 25 03:51:00 GMT 1998


>>>>> John Wehle <john@feith.com> writes:

> The enclosed program when compiled using -O2 on a x86 platform
> shows what appears to be a bug handling *(short *)&a.  It seems
> that *(short *)&a is being treated as *(int *)&a which is wrong,
> or else I'm missing something obvious.

The x86 is little-endian, so you are tweaking the lower 16 bits of the
int.  Playing with pointers like that is a bad idea.

Jason



More information about the Gcc-bugs mailing list