From d3b080bc72ce3f0a707c7755f0917a283ec8c788 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 5 Sep 2017 09:47:21 +0000 Subject: 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. : Use the DECL of the cloned type directly, if any. From-SVN: r251706 --- gcc/ada/gcc-interface/decl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gcc/ada/gcc-interface/decl.c') 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; } -- cgit v1.1