This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR objc/18408 (but really a gimplifier fix)



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]