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: [Ada PATCH] don't modify record fields in update_pointer_to


[Please always post ChangeLog with patches]

> When an unconstrained array type is frozen, update_pointer_to updates
> the fat pointer type for the old, dummy, type and makes it point to the
> new type.  It does this by overwriting the old pointer type's fields (a
> fat pointer is a record) with the fields from the new fat pointer.  This
> leads to trouble, since the original fields may have been used already,
> for example in a COMPONENT_REF or a CONSTRUCTOR: after the update, the
> field argument of the component reference is no longer a field of the
> type being referenced!

Right, this is a little disturbing at first sight.

> You can get away with this in mainline gcc, because it simply doesn't
> notice, however this instantly caused trouble in my port of the Ada f-e to
> LLVM.  This patch changes update_pointer_to so as to not replace fields:
> instead it uses update_pointer_to (simple pointer case) to update the
> pointer types used in the fields.  For this to work, the dummy fat pointer
> fields are changed from being void pointers into pointers to dummy nodes.

Last time I tried to do something like that, the hell breaks loose with the 
PLACEHOLDER_EXPR machinery.  But your attempt looks more clever because it is 
piggybacked on dummy nodes.

Unfortunately the FSF mainline code is somewhat outdated wrt to dummy nodes 
and fat-pointer types, so I'm not sure your patch will still work once they 
are again synchronized with that of AdaCore.

-- 
Eric Botcazou


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