summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-05-29 13:35:57 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2022-07-04 07:45:58 +0000
commit0896e2b79a3f7864b08f221a157a5c7fe8958116 (patch)
treea20d80503b0edc63049624db0816801316bbe170
parent2cad8a59a8060b0897d18d4075d96eb7c541e845 (diff)
downloadgcc-0896e2b79a3f7864b08f221a157a5c7fe8958116.tar.gz
[Ada] Adjust previous change to Rewrite_As_Renaming
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.
-rw-r--r--gcc/ada/exp_ch3.adb19
-rw-r--r--gcc/ada/sinfo.ads2
2 files changed, 14 insertions, 7 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 75d94b0947a..9759c8d0512 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -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
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index e18a427f9a2..57c6438130b 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -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,