This is the mail archive of the gcc-patches@gcc.gnu.org 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: PR middle-end/29862: Calling a function with gcc_assert


We shouldn't call mpfr_set_str with gcc_assert since it leads to
mpfr_set_str is only called when runtime check is enabled. This
patch fixes it.


H.J.
----
2006-11-15  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/29862
	* real.c (mpfr_from_real): Call mpfr_set_str before gcc_assert.

--- gcc/real.c.assert	2006-11-15 08:34:58.000000000 -0800
+++ gcc/real.c	2006-11-15 18:07:36.000000000 -0800
@@ -4930,11 +4930,13 @@ mpfr_from_real (mpfr_ptr m, const REAL_V
 {
   /* We use a string as an intermediate type.  */
   char buf[128];
+  int ret;
 
   real_to_hexadecimal (buf, r, sizeof (buf), 0, 1);
   /* mpfr_set_str() parses hexadecimal floats from strings in the same
      format that GCC will output them.  Nothing extra is needed.  */
-  gcc_assert (mpfr_set_str (m, buf, 16, GMP_RNDN) == 0);
+  ret = mpfr_set_str (m, buf, 16, GMP_RNDN);
+  gcc_assert (ret == 0);
 }
 
 /* Convert from MPFR to REAL_VALUE_TYPE.  */


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