diff mbox

[Ada] Minor adjustment to implementation of 'Min/'Max

Message ID 1555029.2mtgh8fZ7U@polaris
State New
Headers show

Commit Message

Eric Botcazou May 26, 2015, 8:41 p.m. UTC
We don't need the C99-like treatment if we don't expect NaN's.

Tested on x86_64-suse-linux, applied on the mainline.


2015-05-26  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Min/Attr_Max>: Do not
	bother about NaN's if Machine_Overflows is true.
diff mbox

Patch

Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 223716)
+++ gcc-interface/trans.c	(working copy)
@@ -2283,7 +2283,8 @@  Attribute_to_gnu (Node_Id gnat_node, tre
 	   a NaN so we implement the semantics of C99 f{min,max} to make it
 	   predictable in this case: if either operand is a NaN, the other
 	   is returned; if both operands are NaN's, a NaN is returned.  */
-	if (SCALAR_FLOAT_TYPE_P (gnu_result_type))
+	if (SCALAR_FLOAT_TYPE_P (gnu_result_type)
+	    && !Machine_Overflows_On_Target)
 	  {
 	    const bool lhs_side_effects_p = TREE_SIDE_EFFECTS (gnu_lhs);
 	    const bool rhs_side_effects_p = TREE_SIDE_EFFECTS (gnu_rhs);