diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-01-13 11:42:37 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-01-13 11:42:37 +0100 |
commit | 00f45f309076825e5bae672ffc2229fbe6ef8d88 (patch) | |
tree | ff983b37d2975254808502a007da8cc9fd9fb3e9 /gcc/ada/exp_ch4.adb | |
parent | eaed322611b9c09a746f84e6280cdd400aaf9d60 (diff) | |
download | gcc-00f45f309076825e5bae672ffc2229fbe6ef8d88.zip gcc-00f45f309076825e5bae672ffc2229fbe6ef8d88.tar.gz gcc-00f45f309076825e5bae672ffc2229fbe6ef8d88.tar.bz2 |
[multiple changes]
2017-01-13 Ed Schonberg <schonberg@adacore.com>
* sem_util.ads, sem_util.adb (Choice_List): Move function here
from sem_aggr.adb, for use elsewhere.
* sem_ch3.adb (Analyze_Object_Declaration): Use Choice_List.
* sem_aggr.adb (Resolve_Array_Aggregate): Remove
Iterated_Component_Present.
* exp_aggr.adb: Use Choice_List throughout, to handle
Iterated_Component_Associations.
(Gen_Loop): Generate proper loop for an
Iterated_Component_Association: loop variable has the identifier
of the original association. Generate a loop even for a single
component choice, in order to make loop parameter visible in
expression.
(Flatten): An Iterated_Component_Association is not static.
2017-01-13 Yannick Moy <moy@adacore.com>
* exp_ch4.adb (Expand_N_Op_Expon): Ensure that the value of
float exponentiation for statically known small negative values
is the reciprocal of the exponentiation for the opposite value
of the exponent.
* s-exnllf.adb (Exn_Float, Exn_Long_Float, Exn_Long_Long_Float):
Ensure that the value of float exponentiation for negative values
is the reciprocal of the exponentiation for the opposite value
of the exponent.
* inline.adb (Expand_Inlined_Call): Fix the count
for the number of generated gotos.
From-SVN: r244414
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r-- | gcc/ada/exp_ch4.adb | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index b89d66c..bdd7209 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -7691,7 +7691,11 @@ package body Exp_Ch4 is -- the case of 0.0 ** (negative) even if Machine_Overflows = False. -- See ACVC test C4A012B, and it is not worth generating the test. - if Expv >= 0 and then Expv <= 4 then + -- For small negative exponents, we return the reciprocal of + -- the folding of the exponentiation for the opposite (positive) + -- exponent, as required by Ada RM 4.5.6(11/3). + + if abs Expv <= 4 then -- X ** 0 = 1 (or 1.0) @@ -7742,8 +7746,7 @@ package body Exp_Ch4 is -- in -- En * En - else - pragma Assert (Expv = 4); + elsif Expv = 4 then Temp := Make_Temporary (Loc, 'E', Base); Xnode := @@ -7766,6 +7769,26 @@ package body Exp_Ch4 is Make_Op_Multiply (Loc, Left_Opnd => New_Occurrence_Of (Temp, Loc), Right_Opnd => New_Occurrence_Of (Temp, Loc)))); + + -- X ** N = 1.0 / X ** (-N) + -- N in -4 .. -1 + + else + pragma Assert + (Expv = -1 or Expv = -2 or Expv = -3 or Expv = -4); + Xnode := + Make_Op_Divide (Loc, + Left_Opnd => + Make_Float_Literal (Loc, + Radix => Uint_1, + Significand => Uint_1, + Exponent => Uint_0), + Right_Opnd => + Make_Op_Expon (Loc, + Left_Opnd => Duplicate_Subexpr (Base), + Right_Opnd => + Make_Integer_Literal (Loc, + Intval => -Expv))); end if; Rewrite (N, Xnode); |