This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR objc/18408 (but really a gimplifier fix)
- From: Ziemowit Laski <zlaski at apple dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 10 Dec 2004 16:29:09 -0800
- Subject: Re: PATCH: PR objc/18408 (but really a gimplifier fix)
- References: <F96932D4-344A-11D9-93ED-000D9330C50E@apple.com> <xypzn0l4tzg.fsf@miranda.boston.redhat.com>
On 10 Dec 2004, at 15.24, Jason Merrill wrote:
On Thu, 11 Nov 2004 17:34:20 -0800, Ziemowit Laski <zlaski@apple.com>
wrote:
The gimplification process involves stripping useless (to the
back-end --
ObjC does need them!) type conversions, such as NOP_EXPRs. This can
be a
problem if the NOP_EXPR in question is the argument of an INDIRECT_REF
(e.g., '(*(List_linked*)collection).firstLink'); once the NOP_EXPR is
removed, the INDIRECT_REF now has a type that is inconsistent with
that of
its (new) operand, leading to an assert failure later on.
Why is this conversion considered useless (and thus stripped)? List
and
List_linked certainly seem like different types to me.
In the example, 'List_linked' is a subclass of 'List', and it is the
latter that has the 'collection' field. So
(*List_linked*)collection).firstLink
can be validly transformed to
(*collection).firstLink
A separate question (and one I'm not equipped to answer) is whether the
gimplifier really _is_ supposed to strip out the cast in this case; my
patch assumes that it is.
--Zem