This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Fwd: Objective-C and C99 strict aliasing
On Wed, Apr 8, 2009 at 5:42 PM, Ian Lance Taylor <iant@google.com> wrote:
> John Engelhart <john.engelhart@gmail.com> writes:
>
>> Objective-C defines 'c_common_get_alias_set' as its language specific
>> alias set manager. Âc_common_get_alias_set() seems(?) to only
>> implement C's strict aliasing rules, with no provisions for
>> Objective-C's needs.
>
>> Can anyone with a much better understanding of GCC's internals comment on this?
>
> I think you are correct about what is happening today.
>
> Since I don't know anything about Objective C, I don't know what should
> happen instead. ÂI would guess that you would want to set up a tree of
> alias sets, using record_alias_subset.
The 'right thing' is pretty tricky. I've given it some thought and I
can't come up with a simple set of rules that cleanly mesh with C99's
rules. I think that coming up with a 'right answer' would take an
awful lot of very carefully considered thought.
The easiest, and I think safest, course of action would be to add a
line in c_common_get_alias_set similar to the one I suggested. That
is, if it is a pointer to something that looks even remotely like an
objective-c "object", then just assume that it can alias anything.
Any recommendations on what to do next? Filing a bug seems like the
step, I just wanted to see if I had missed something in my analysis of
the problem.