aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2017-09-05 09:47:21 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2017-09-05 09:47:21 +0000
commitd3b080bc72ce3f0a707c7755f0917a283ec8c788 (patch)
treec9d08c3878aec12faca42f7ea41f0941f72f3333 /gcc/ada/gcc-interface
parenta4f7374e4d6bfb7a26bfb85c2c914688d4b07b10 (diff)
downloadgcc-d3b080bc72ce3f0a707c7755f0917a283ec8c788.zip
gcc-d3b080bc72ce3f0a707c7755f0917a283ec8c788.tar.gz
gcc-d3b080bc72ce3f0a707c7755f0917a283ec8c788.tar.bz2
re PR ada/62235 (segmentation fault on Ada 2012 code)
PR ada/62235 * gcc-interface/decl.c (gnat_to_gnu_entity): Skip regular processing for Itypes that are E_Record_Subtype with a cloned subtype. <E_Record_Subtype>: Use the DECL of the cloned type directly, if any. From-SVN: r251706
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r--gcc/ada/gcc-interface/decl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 569fe85..a7272e4 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -312,11 +312,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
/* Since a use of an Itype is a definition, process it as such if it is in
the main unit, except for E_Access_Subtype because it's actually a use
- of its base type, see below. */
+ of its base type, and for E_Record_Subtype with cloned subtype because
+ it's actually a use of the cloned subtype, see below. */
if (!definition
&& is_type
&& Is_Itype (gnat_entity)
- && Ekind (gnat_entity) != E_Access_Subtype
+ && !(kind == E_Access_Subtype
+ || (kind == E_Record_Subtype
+ && Present (Cloned_Subtype (gnat_entity))))
&& !present_gnu_tree (gnat_entity)
&& In_Extended_Main_Code_Unit (gnat_entity))
{
@@ -3411,7 +3414,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
{
gnu_decl = gnat_to_gnu_entity (Cloned_Subtype (gnat_entity),
NULL_TREE, false);
- maybe_present = true;
+ saved = true;
break;
}