[Ada] Disable expansion of 'Min/'Max of floating point types
authorJavier Miranda <miranda@adacore.com>
Mon, 1 Jul 2019 13:34:45 +0000 (13:34 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 1 Jul 2019 13:34:45 +0000 (13:34 +0000)
2019-07-01  Javier Miranda  <miranda@adacore.com>

gcc/ada/

* exp_attr.adb (Expand_Min_Max_Attribute): Disable expansion of
'Min/'Max on integer, enumeration, fixed point and floating
point types since the CCG backend now provides in file
standard.h routines to support it.

From-SVN: r272858

gcc/ada/ChangeLog
gcc/ada/exp_attr.adb

index 31fecb6..7bb2605 100644 (file)
@@ -1,3 +1,10 @@
+2019-07-01  Javier Miranda  <miranda@adacore.com>
+
+       * exp_attr.adb (Expand_Min_Max_Attribute): Disable expansion of
+       'Min/'Max on integer, enumeration, fixed point and floating
+       point types since the CCG backend now provides in file
+       standard.h routines to support it.
+
 2019-07-01  Hristian Kirtchev  <kirtchev@adacore.com>
 
        * impunit.adb: Add GNAT.Graphs to list Non_Imp_File_Names_95.
index cbf7db3..7d3a6c4 100644 (file)
@@ -1694,9 +1694,15 @@ package body Exp_Attr is
 
       Check_Restriction (No_Implicit_Conditionals, N);
 
-      --  In Modify_Tree_For_C mode, we rewrite as an if expression
-
-      if Modify_Tree_For_C then
+      --  In Modify_Tree_For_C mode, we rewrite as an if expression (unless it
+      --  is supported).
+
+      if Modify_Tree_For_C
+        and then not Is_Integer_Type (Etype (N))
+        and then not Is_Enumeration_Type (Etype (N))
+        and then not Is_Fixed_Point_Type (Etype (N))
+        and then not Is_Floating_Point_Type (Etype (N))
+      then
          declare
             Loc   : constant Source_Ptr := Sloc (N);
             Typ   : constant Entity_Id  := Etype (N);