aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2018-07-16 14:10:27 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-07-16 14:10:27 +0000
commita3b7645bffbaf3dadf1f9cfccd93c6fba3e0834d (patch)
treeefe83c064e59079cd0bcf4b9b0fa565d139baf18 /gcc/ada
parentc4ea29786f9b6e63c47daddfb6bff5b690e5f555 (diff)
downloadgcc-a3b7645bffbaf3dadf1f9cfccd93c6fba3e0834d.zip
gcc-a3b7645bffbaf3dadf1f9cfccd93c6fba3e0834d.tar.gz
gcc-a3b7645bffbaf3dadf1f9cfccd93c6fba3e0834d.tar.bz2
[Ada] Crash processing sources under GNATprove debug mode
Processing sources under -gnatd.F the frontend may crash on an iterator of the form 'for X of ...' over an array if the iterator is located in an inlined subprogram. 2018-07-16 Javier Miranda <miranda@adacore.com> gcc/ada/ * exp_ch5.adb (Expand_Iterator_Loop_Over_Array): Code cleanup. Required to avoid generating an ill-formed tree that confuses gnatprove causing it to blowup. gcc/testsuite/ * gnat.dg/iter2.adb, gnat.dg/iter2.ads: New testcase. From-SVN: r262707
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/exp_ch5.adb11
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index d041f56..bff06e6 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-16 Javier Miranda <miranda@adacore.com>
+
+ * exp_ch5.adb (Expand_Iterator_Loop_Over_Array): Code cleanup. Required
+ to avoid generating an ill-formed tree that confuses gnatprove causing
+ it to blowup.
+
2018-07-16 Yannick Moy <moy@adacore.com>
* inline.adb (Has_Single_Return): Rewrap comment.
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index e0cff91..7371ee3 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -3711,9 +3711,14 @@ package body Exp_Ch5 is
Ind_Comp :=
Make_Indexed_Component (Loc,
- Prefix => Relocate_Node (Array_Node),
+ Prefix => New_Copy_Tree (Array_Node),
Expressions => New_List (New_Occurrence_Of (Iterator, Loc)));
+ -- Propagate the original node to the copy since the analysis of the
+ -- following object renaming declaration relies on the original node.
+
+ Set_Original_Node (Prefix (Ind_Comp), Original_Node (Array_Node));
+
Prepend_To (Stats,
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Id,
@@ -3755,7 +3760,7 @@ package body Exp_Ch5 is
Defining_Identifier => Iterator,
Discrete_Subtype_Definition =>
Make_Attribute_Reference (Loc,
- Prefix => Relocate_Node (Array_Node),
+ Prefix => New_Copy_Tree (Array_Node),
Attribute_Name => Name_Range,
Expressions => New_List (
Make_Integer_Literal (Loc, Dim1))),
@@ -3792,7 +3797,7 @@ package body Exp_Ch5 is
Defining_Identifier => Iterator,
Discrete_Subtype_Definition =>
Make_Attribute_Reference (Loc,
- Prefix => Relocate_Node (Array_Node),
+ Prefix => New_Copy_Tree (Array_Node),
Attribute_Name => Name_Range,
Expressions => New_List (
Make_Integer_Literal (Loc, Dim1))),