This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][convert.c] PR 61876: Guard transformation to lrint by -fno-math-errno

Hi all,

Following up on Josephs' comments on PR 61876 this patch guards the rint + cast -> lrint transformation on -fno-math-errno.

Bootstrapped and tested on aarch64-linux and x86.

Ok for trunk?


2014-08-04  Kyrylo Tkachov  <>

    * convert.c (convert_to_integer): Guard transformation to lrint by
commit e519f002ee27701b1b890dd8b303dc45d4e4595c
Author: Kyrylo Tkachov <>
Date:   Fri Jul 25 16:21:23 2014 +0100

    [convert.c] Guard transform to lrint with -fno-math-errno

diff --git a/gcc/convert.c b/gcc/convert.c
index 8dbf3cb..3834351 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -477,8 +477,8 @@ convert_to_integer (tree type, tree expr)
 	  /* ... Fall through ...  */
-	  /* Only convert in ISO C99 mode.  */
-	  if (!targetm.libc_has_function (function_c99_misc))
+	  /* Only convert in ISO C99 mode and with -fno-math-errno.  */
+	  if (!targetm.libc_has_function (function_c99_misc) || flag_errno_math)
 	  if (outprec < TYPE_PRECISION (integer_type_node)
 	      || (outprec == TYPE_PRECISION (integer_type_node)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]