public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Change rounding mode of 'Machine for static floating point
@ 2021-04-29  8:03 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-04-29  8:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

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.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 571 bytes --]

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);
 
       ------------------



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-29  8:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29  8:03 [Ada] Change rounding mode of 'Machine for static floating point Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).