From 583eb0c997f44e4e6b3aff9c7a7ef92e0bd137db Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 2 Apr 2011 08:50:32 +0000 Subject: [PATCH] decl.c (gnat_to_gnu_entity): Do not make fat pointer types artificial unconditionally. * gcc-interface/decl.c (gnat_to_gnu_entity) : Do not make fat pointer types artificial unconditionally. : Attach the base array type as a parallel type if it isn't artificial. From-SVN: r171883 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/gcc-interface/decl.c | 29 ++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e76786dab17..dd108225ccd 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2011-04-02 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Do not make + fat pointer types artificial unconditionally. + : Attach the base array type as a parallel type if it + isn't artificial. + 2011-04-02 Eric Botcazou * gcc-interface/gigi.h (get_dummy_type): Declare. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 64d60b77bb1..7a18d32752a 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -2175,7 +2175,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) else gnat_name = gnat_entity; create_type_decl (create_concat_name (gnat_name, "XUP"), - gnu_fat_type, NULL, true, + gnu_fat_type, NULL, !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); /* Create the type to be used as what a thin pointer designates: @@ -2537,14 +2537,25 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) add_parallel_type (TYPE_STUB_DECL (gnu_type), gnu_bound_rec); } - /* Otherwise, for a packed array, make the original array type a - parallel type. */ - else if (debug_info_p - && Is_Packed_Array_Type (gnat_entity) - && present_gnu_tree (Original_Array_Type (gnat_entity))) - add_parallel_type (TYPE_STUB_DECL (gnu_type), - gnat_to_gnu_type - (Original_Array_Type (gnat_entity))); + /* If this is a packed array type, make the original array type a + parallel type. Otherwise, do it for the base array type if it + isn't artificial to make sure it is kept in the debug info. */ + if (debug_info_p) + { + if (Is_Packed_Array_Type (gnat_entity) + && present_gnu_tree (Original_Array_Type (gnat_entity))) + add_parallel_type (TYPE_STUB_DECL (gnu_type), + gnat_to_gnu_type + (Original_Array_Type (gnat_entity))); + else + { + tree gnu_base_decl + = gnat_to_gnu_entity (Etype (gnat_entity), NULL_TREE, 0); + if (!DECL_ARTIFICIAL (gnu_base_decl)) + add_parallel_type (TYPE_STUB_DECL (gnu_type), + TREE_TYPE (TREE_TYPE (gnu_base_decl))); + } + } TYPE_CONVENTION_FORTRAN_P (gnu_type) = convention_fortran_p; TYPE_PACKED_ARRAY_TYPE_P (gnu_type) -- 2.30.2