How to use __attribute__((__may_alias__))

Ian Lance Taylor iant@google.com
Wed Mar 18 00:06:00 GMT 2009


John Fine <johnsfine@verizon.net> writes:

> I tried
> DAT __attribute__((__may_alias__))* pp=foo();
> and
> DAT* __attribute__((__may_alias__)) pp=foo();
> but neither of those make any difference.

The may_alias attribute is normally applied to a type, not a variable.
It is possible that the attribute got dropped somewhere during
optimization.  That would be a bug, but I expect that this case is not
well tested.

I know you said that you didn't want to use a union, but that is what I
would recommend.  Using a union need not have any performance impact.

Ian



More information about the Gcc-help mailing list