aliasing warnings [patch]
Mark Mitchell
markATcodesourcery.com
Thu Sep 16 14:22:00 GMT 1999
>>>>> "Richard" == Richard Henderson <rth@cygnus.com> writes:
Richard> On Thu, Sep 16, 1999 at 01:07:52PM -0700, Mark Mitchell
Richard> wrote:
>> The underlying type of the fields is `char' and you're putting
>> `int' into them. That's no different than:
>>
>> char c[4]; *((int *) &c[0]) = 3;
Richard> Modulo the alignment argument, isn't this really ok?
Richard> True, the variable has `char' type, but the storage is
Richard> only accessed as `int'.
I don't think GCC will generate bad code in this case, because of what
you say. (There's no aliasing issue if all rferences are through the
`int *'.) But, I don't think this is conforming ISO C. The dynamic
type of the object is `char ()[4]', while the lvalue is of type `int'.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the Gcc-patches
mailing list