aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2015-05-26 08:12:15 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2015-05-26 10:12:15 +0200
commit5389e4ae852628dd9624537c67588c0f2675dd01 (patch)
tree3576f2d681f05deace29edc596ca82857e6ddbaf
parentffcfb997e0a400614011e8f8b28f30eb68d1966a (diff)
downloadgcc-5389e4ae852628dd9624537c67588c0f2675dd01.zip
gcc-5389e4ae852628dd9624537c67588c0f2675dd01.tar.gz
gcc-5389e4ae852628dd9624537c67588c0f2675dd01.tar.bz2
exp_ch4.adb (Expand_N_Op_Expon): Deal with problem of wrong order in calling Duplicate_Subexpr.
2015-05-26 Robert Dewar <dewar@adacore.com> * exp_ch4.adb (Expand_N_Op_Expon): Deal with problem of wrong order in calling Duplicate_Subexpr. * einfo.ads: Fix documentation of Object/Value size for scalar types. From-SVN: r223665
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/einfo.ads8
-rw-r--r--gcc/ada/exp_ch4.adb19
3 files changed, 25 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index da38705..c0d03c3 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2015-05-26 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Op_Expon): Deal with problem of wrong
+ order in calling Duplicate_Subexpr.
+ * einfo.ads: Fix documentation of Object/Value size for scalar types.
+
2015-05-26 Ed Schonberg <schonberg@adacore.com>
* exp_aggr.adb (Build_Array_Aggr_Code, Gen_Assign):
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 5a309f9..b5d7769 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -218,11 +218,13 @@ package Einfo is
-- subtype x4 is x2'base range 0 .. 10; 8 4
--- subtype x5 is x2 range 0 .. dynamic; 16 (7)
+-- dynamic : x2'Base range -64 .. +63;
--- subtype x6 is x2'base range 0 .. dynamic; 8 (7)
+-- subtype x5 is x2 range 0 .. dynamic; 16 3*
--- Note: the entries marked (7) are not actually specified by the Ada 95 RM,
+-- subtype x6 is x2'base range 0 .. dynamic; 8 7*
+
+-- Note: the entries marked * are not actually specified by the Ada 95 RM,
-- but it seems in the spirit of the RM rules to allocate the minimum number
-- of bits known to be large enough to hold the given range of values.
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 7bd3c6b..4dcc9be 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -7779,6 +7779,9 @@ package body Exp_Ch4 is
TestS : Boolean;
-- Set True if we must test the shift count
+ Test_Gt : Node_Id;
+ -- Node for test against TestS
+
begin
-- Compute maximum shift based on the underlying size. For a
-- modular type this is one less than the size.
@@ -7841,15 +7844,21 @@ package body Exp_Ch4 is
-- zero if this shift count is exceeded.
if TestS then
+
+ -- Note: build node for the comparison first, before we
+ -- reuse the Right_Opnd, so that we have proper parents
+ -- in place for the Duplicate_Subexpr call.
+
+ Test_Gt :=
+ Make_Op_Gt (Loc,
+ Left_Opnd => Duplicate_Subexpr (Right_Opnd (N)),
+ Right_Opnd => Make_Integer_Literal (Loc, MaxS));
+
Rewrite (N,
Make_If_Expression (Loc,
Expressions => New_List (
- Make_Op_Gt (Loc,
- Left_Opnd => Duplicate_Subexpr (Right_Opnd (N)),
- Right_Opnd => Make_Integer_Literal (Loc, MaxS)),
-
+ Test_Gt,
Make_Integer_Literal (Loc, Uint_0),
-
Make_Op_Shift_Left (Loc,
Left_Opnd => Make_Integer_Literal (Loc, Uint_1),
Right_Opnd => Right_Opnd (N)))));