diff mbox series

[Ada] Change rounding mode of 'Machine for static floating point

Message ID 20210429080348.GA134047@adacore.com
State New
Headers show
Series [Ada] Change rounding mode of 'Machine for static floating point | expand

Commit Message

Pierre-Marie de Rodat April 29, 2021, 8:03 a.m. UTC
This changes the rounding mode used for the static evaluation of the
Machine attribute of floating-point types to the mode used for the
static evaluation of real expressions, for the sake of consistency.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_attr.adb (Eval_Attribute) <Attribute_Machine>: Use
	Round_Even instead of Round in the call to the Machine routine.
diff mbox series

Patch

diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -9107,11 +9107,13 @@  package body Sem_Attr is
       -- Machine --
       -------------
 
+      --  We use the same rounding mode as the one used for RM 4.9(38)
+
       when Attribute_Machine =>
          Fold_Ureal
            (N,
             Eval_Fat.Machine
-              (P_Base_Type, Expr_Value_R (E1), Eval_Fat.Round, N),
+              (P_Base_Type, Expr_Value_R (E1), Eval_Fat.Round_Even, N),
             Static);
 
       ------------------