diff options
| author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-23 09:44:59 +0000 |
|---|---|---|
| committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-23 09:44:59 +0000 |
| commit | 8beebd64f02930f2e69cc0d6c5e2523ae8ffc7a7 (patch) | |
| tree | 80a9936e46ae94b8ae88d45dc7df0447407fd733 | |
| parent | 938494c29be6e0a78275bdce7f6cb0ff29f69725 (diff) | |
| download | ppe42-gcc-8beebd64f02930f2e69cc0d6c5e2523ae8ffc7a7.tar.gz ppe42-gcc-8beebd64f02930f2e69cc0d6c5e2523ae8ffc7a7.zip | |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149985 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/ada/exp_ch4.adb | 22 |
2 files changed, 22 insertions, 6 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1432873f6f6..8ff8a468af5 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +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> * gnat_ugn.texi: Update doc on Misnamed_Identifiers rule. diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index c55cfa54050..b982ca6cca6 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -7991,12 +7991,22 @@ package body Exp_Ch4 is if Present (Inner_Type) then - -- Test for binary operation. Note that this includes junk like - -- XOR and concatenation, but none of those will yield a signed - -- integer result, so we won't get here except in the interesting - -- cases of simple arithmetic operators like addition. - - if Nkind (Operand) in N_Binary_Op then + -- Test for interesting binary operation, which includes addition, + -- exponentiation, multiplication, and subtraction. We do not + -- include division in the 64-bit case. It is a very marginal + -- situation to get overflow from division in any case (largest + -- negative number divided by minus one), and doing the promotion + -- 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), Make_Type_Conversion (Loc, Subtype_Mark => New_Reference_To (Inner_Type, Loc), |

