This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How to use __attribute__((__may_alias__))
- From: Ian Lance Taylor <iant at google dot com>
- To: John Fine <johnsfine at verizon dot net>
- Cc: "gcc-help\ at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Tue, 17 Mar 2009 17:06:27 -0700
- Subject: Re: How to use __attribute__((__may_alias__))
- References: <49C01A33.9030400@verizon.net>
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