aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-11-20 21:29:13 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-12-14 10:51:53 -0500
commita36a291399fbcf24d5ea237850b862921ebdec95 (patch)
tree2c5b62aaba688b4e73a79b5100831f8bcd2ce4af /gcc
parent77c44637af3c9f5b974cf02cb80d1abb3b2ce210 (diff)
downloadgcc-a36a291399fbcf24d5ea237850b862921ebdec95.zip
gcc-a36a291399fbcf24d5ea237850b862921ebdec95.tar.gz
gcc-a36a291399fbcf24d5ea237850b862921ebdec95.tar.bz2
[Ada] Fix internal error on bit-packed array in Volatile_Full_Access record
gcc/ada/ * exp_pakd.adb (Expand_Bit_Packed_Element_Set): Fix again packed array type in complex cases where array is Volatile. * exp_util.adb (Remove_Side_Effects): Do not force a renaming to be handled by the back-end.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_pakd.adb11
-rw-r--r--gcc/ada/exp_util.adb9
2 files changed, 12 insertions, 8 deletions
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb
index 07a05a5..c90409b 100644
--- a/gcc/ada/exp_pakd.adb
+++ b/gcc/ada/exp_pakd.adb
@@ -1256,8 +1256,15 @@ package body Exp_Pakd is
-- array type on Obj to get lost. So we save the type of Obj, and
-- make sure it is reset properly.
- New_Lhs := Duplicate_Subexpr (Obj, Name_Req => True);
- New_Rhs := Duplicate_Subexpr_No_Checks (Obj);
+ declare
+ T : constant Entity_Id := Etype (Obj);
+ begin
+ New_Lhs := Duplicate_Subexpr (Obj, Name_Req => True);
+ New_Rhs := Duplicate_Subexpr_No_Checks (Obj);
+ Set_Etype (Obj, T);
+ Set_Etype (New_Lhs, T);
+ Set_Etype (New_Rhs, T);
+ end;
-- First we deal with the "and"
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 9e08e9c..86e46ea 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -11798,8 +11798,8 @@ package body Exp_Util is
-- If this is a packed array component or a selected component with a
-- nonstandard representation, we cannot generate a reference because
-- the component may be unaligned, so we must use a renaming and this
- -- renaming must be handled by the front end, as the back end may balk
- -- at the nonstandard representation (see Exp_Ch2.Expand_Renaming).
+ -- renaming is handled by the front end, as the back end may balk at
+ -- the nonstandard representation (see Evaluation_Required in Exp_Ch8).
elsif Nkind (Exp) in N_Indexed_Component | N_Selected_Component
and then Has_Non_Standard_Rep (Etype (Prefix (Exp)))
@@ -11813,8 +11813,7 @@ package body Exp_Util is
Subtype_Mark => New_Occurrence_Of (Exp_Type, Loc),
Name => Relocate_Node (Exp)));
- -- For an expression that denotes a name, we can use a renaming scheme
- -- that is handled by the back end, instead of the front end as above.
+ -- For an expression that denotes a name, we can use a renaming scheme.
-- This is needed for correctness in the case of a volatile object of
-- a nonvolatile type because the Make_Reference call of the "default"
-- approach would generate an illegal access value (an access value
@@ -11837,8 +11836,6 @@ package body Exp_Util is
Subtype_Mark => New_Occurrence_Of (Exp_Type, Loc),
Name => Relocate_Node (Exp)));
- Set_Is_Renaming_Of_Object (Def_Id, False);
-
-- Avoid generating a variable-sized temporary, by generating the
-- reference just for the function call. The transformation could be
-- refined to apply only when the array component is constrained by a