Commit 27f55f3c by Robert Dewar Committed by Arnaud Charlet

exp_ch4.adb (Expand_N_Type_Conversion): Don't promote integer division operands…

exp_ch4.adb (Expand_N_Type_Conversion): Don't promote integer division operands to 64-bit inside a conversion if...

2009-07-23  Robert Dewar  <dewar@adacore.com>

	* exp_ch4.adb (Expand_N_Type_Conversion): Don't promote integer
	division operands to 64-bit inside a conversion if 64-bit division not
	available.

From-SVN: r149985
parent 1c5c721a
2009-07-23 Robert Dewar <dewar@adacore.com>
* exp_ch4.adb (Expand_N_Type_Conversion): Don't promote integer
division operands to 64-bit inside a conversion if 64-bit division not
available.
2009-07-23 Sergey Rybin <rybin@adacore.com> 2009-07-23 Sergey Rybin <rybin@adacore.com>
* gnat_ugn.texi: Update doc on Misnamed_Identifiers rule. * gnat_ugn.texi: Update doc on Misnamed_Identifiers rule.
......
...@@ -7991,12 +7991,22 @@ package body Exp_Ch4 is ...@@ -7991,12 +7991,22 @@ package body Exp_Ch4 is
if Present (Inner_Type) then if Present (Inner_Type) then
-- Test for binary operation. Note that this includes junk like -- Test for interesting binary operation, which includes addition,
-- XOR and concatenation, but none of those will yield a signed -- exponentiation, multiplication, and subtraction. We do not
-- integer result, so we won't get here except in the interesting -- include division in the 64-bit case. It is a very marginal
-- cases of simple arithmetic operators like addition. -- situation to get overflow from division in any case (largest
-- negative number divided by minus one), and doing the promotion
if Nkind (Operand) in N_Binary_Op then -- may result in less efficient code. Worse still we may end up
-- promoting to 64-bit divide on a target that does not support
-- this operation, causing a fatal error.
if Nkind_In (Operand, N_Op_Add,
N_Op_Expon,
N_Op_Multiply,
N_Op_Subtract)
or else (Nkind (Operand) = N_Op_Divide
and then Inner_Type /= Standard_Long_Long_Integer)
then
Rewrite (Left_Opnd (Operand), Rewrite (Left_Opnd (Operand),
Make_Type_Conversion (Loc, Make_Type_Conversion (Loc,
Subtype_Mark => New_Reference_To (Inner_Type, Loc), Subtype_Mark => New_Reference_To (Inner_Type, Loc),
......
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