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: Sat, 9 Jun 2007 23:25:11 +0200
- Subject: Re: [Ada PATCH] don't modify record fields in update_pointer_to
- References: <200702211356.45659.baldrick@free.fr> <200706072136.39339.baldrick@free.fr> <200706091544.22732.baldrick@free.fr>
> here you go: I changed to gnat_desig_equiv and added a bunch of comments
> to update_pointer_to.
Thanks a lot. I have a last minute question though. :-)
+ /* Create the new array type and update old array pointers. */
+ update_pointer_to
+ (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (new_ptr))),
+ gnat_substitute_in_type (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (new_ptr))),
+ TREE_CHAIN (TYPE_FIELDS (new_ptr)), new_ref));
+
+ /* Make pointers to the dummy array also point to the new array. */
+ update_pointer_to
+ (TREE_TYPE (TREE_TYPE (array_field)),
+ TREE_TYPE (TREE_TYPE (TYPE_FIELDS (new_ptr))));
It seems to me that we can simplify this into:
+ /* Create the new array type and adjust pointers to the dummy array. */
+ update_pointer_to
+ (TREE_TYPE (TREE_TYPE (array_field)),
+ gnat_substitute_in_type (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (new_ptr))),
+ TREE_CHAIN (TYPE_FIELDS (new_ptr)), new_ref));
What do you think? At least it's clean on ACATS.
[No need to update again the patch, I'll do it if needed.]
--
Eric Botcazou