Commit 5389e4ae by Robert Dewar Committed by Arnaud Charlet

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
parent ffcfb997
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):
......
......@@ -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.
......
......@@ -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)))));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment