This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Ada PATCH] don't modify record fields in update_pointer_to
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Duncan Sands <baldrick at free dot fr>
- Cc: gcc-patches at gcc dot gnu dot org, Arnaud Charlet <charlet at adacore dot com>
- Date: Wed, 21 Feb 2007 18:14:37 +0100
- Subject: Re: [Ada PATCH] don't modify record fields in update_pointer_to
- References: <200702211356.45659.baldrick@free.fr>
[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