[PATCH] fix aliasing for chars in global structure

Mark Mitchell mark@codesourcery.com
Tue Mar 12 10:46:00 GMT 2002


> int compare(struct first *a, struct second *b)
> {
>   return a == b;
> }
>
> could we optimize down to "return 0;" ?)

I think not.  The standard specifically allows you to convert between
pointer types (with some caveats about the widths of pointers, which do
not technically need to be the same).  It's fine to form the pointers;
just not OK to compare them.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com



More information about the Gcc-patches mailing list