+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):
-- 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.
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.
-- 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)))));