]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Adjust previous change to Rewrite_As_Renaming
authorEric Botcazou <ebotcazou@adacore.com>
Sun, 29 May 2022 11:35:57 +0000 (13:35 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 4 Jul 2022 07:45:58 +0000 (07:45 +0000)
gcc/ada/

* exp_ch3.adb (Expand_N_Object_Declaration.Rewrite_As_Renaming):
Do not rewrite if the declaration has got constraints.
* sinfo.ads (Case Expression Alternative): Fix typo.

gcc/ada/exp_ch3.adb
gcc/ada/sinfo.ads

index 75d94b0947a830cf01f5a92d47d98647842c0973..9759c8d0512afe0fed70efa15035914f6f346b50 100644 (file)
@@ -6865,13 +6865,20 @@ package body Exp_Ch3 is
                            and then
                           OK_To_Rename_Entity_Name (Prefix (Expr_Q)))));
       begin
-         --  ??? Return False if there are any aspect specifications, because
-         --  otherwise we duplicate that corresponding implicit attribute
-         --  definition, and call Insert_Action, which has no place to insert
-         --  the attribute definition. The attribute definition is stored in
-         --  Aspect_Rep_Item, which is not a list.
+         return Result
 
-         return Result and then No (Aspect_Specifications (N));
+           --  The declaration cannot be rewritten if it has got constraints,
+           --  in other words the nominal subtype must be unconstrained.
+
+           and then Is_Entity_Name (Original_Node (Obj_Def))
+
+           --  ??? Return False if there are any aspect specifications, because
+           --  otherwise we duplicate that corresponding implicit attribute
+           --  definition, and call Insert_Action, which has no place to insert
+           --  the attribute definition. The attribute definition is stored in
+           --  Aspect_Rep_Item, which is not a list.
+
+           and then No (Aspect_Specifications (N));
       end Rewrite_As_Renaming;
 
       --  Local variables
index e18a427f9a2957878e7a43f7350ba14c7c45bb56..57c6438130b9a42e9962ef8d95e35ec213cc519d 100644 (file)
@@ -4651,7 +4651,7 @@ package Sinfo is
 
       --  Note: The Actions field temporarily holds any actions associated with
       --  evaluation of the Expression. During expansion of the case expression
-      --  these actions are wrapped into an N_Expressions_With_Actions node
+      --  these actions are wrapped into an N_Expression_With_Actions node
       --  replacing the original expression.
 
       --  Note: this node never appears in the tree passed to the back end,