]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Fix bug in if_expressions introduced by var-size nodes changes
authorBob Duff <duff@adacore.com>
Fri, 5 Feb 2021 18:06:13 +0000 (13:06 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 15 Jun 2021 10:19:21 +0000 (06:19 -0400)
gcc/ada/

* gen_il-gen.adb (Setter_Needs_Parent): Add missing
Then_Actions.  Fix self-contradictory comment.
* exp_util.adb (Insert_Actions): Minor comment improvments.

gcc/ada/exp_util.adb
gcc/ada/gen_il-gen.adb

index c6c8d6c62531705be7af579df7a207e8486e29de..1189870bd604756882aebd26ae962e3b2757261f 100644 (file)
@@ -7203,8 +7203,8 @@ package body Exp_Util is
 
                   --  Actions belong to the then expression, temporarily place
                   --  them as Then_Actions of the if expression. They will be
-                  --  moved to the proper place later when the if expression
-                  --  is expanded.
+                  --  moved to the proper place later when the if expression is
+                  --  expanded.
 
                   elsif N = ThenX then
                      if Present (Then_Actions (P)) then
@@ -7217,10 +7217,7 @@ package body Exp_Util is
 
                      return;
 
-                  --  Actions belong to the else expression, temporarily place
-                  --  them as Else_Actions of the if expression. They will be
-                  --  moved to the proper place later when the if expression
-                  --  is expanded.
+                  --  Else_Actions is treated the same as Then_Actions above
 
                   elsif N = ElseX then
                      if Present (Else_Actions (P)) then
index 36662895950660623528abd46e14976fc77038ca..cffbf2a87d16d27ae6fa772fea084ea51bb0bee2 100644 (file)
@@ -479,13 +479,14 @@ package body Gen_IL.Gen is
       Node_Field_Types_Used, Entity_Field_Types_Used : Type_Set;
 
       Setter_Needs_Parent : Field_Set :=
-        (Actions | Expression | Else_Actions => True, others => False);
+        (Actions | Expression | Then_Actions | Else_Actions => True,
+         others => False);
       --  Set of fields where the setter should set the Parent. True for
       --  syntactic fields of type Node_Id and List_Id, but with some
-      --  exceptions. Expression and Else_Actions are syntactic AND semantic,
-      --  and the Parent is needed.  Default_Expression is also both, but the
-      --  Parent is not needed.  Else_Actions is not syntactic, but the Parent
-      --  is needed.
+      --  exceptions. Expression is syntactic AND semantic, and the Parent
+      --  is needed. Default_Expression is also both, but the Parent is not
+      --  needed. Then_Actions and Else_Actions are not syntactic, but the
+      --  Parent is needed.
 
       procedure Check_Completeness;
       --  Check that every type and field has been declared