This is the mail archive of the gcc-bugs@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]

[Bug libfortran/29302] nan_inf_fmt.f90 segfaults on Darwin PPC starting with Xcode 2.4



------- Comment #13 from howarth at nitro dot med dot uc dot edu  2006-10-31 14:14 -------
As I mentioned to Jerry in a private email, his suggestion of...

Index: io/write.c
===================================================================
--- io/write.c  (revision 118229)
+++ io/write.c  (working copy)
@@ -468,6 +468,7 @@ output_float (st_parameter_dt *dtp, cons
   int i;
   sign_t sign;
   double abslog;
+  long tmp_e;

   ft = f->format;
   w = f->u.real.w;
@@ -554,7 +555,8 @@ output_float (st_parameter_dt *dtp, cons
       internal_error (&dtp->common, "printf is broken");

   /* Read the exponent back in.  */
-  e = atoi (&buffer[ndigits + 3]) + 1;
+  tmp_e = atoi (&buffer[ndigits + 3]) + 1;
+  e = (int) tmp-e;

   /* Make sure zero comes out as 0.0e0.  */
   if (value == 0.0)

eliminates the failure in the nan_inf_fmt.f90 testcase on Darwin PPC at all
optimizations as well as -m64. The failure is also suppressed by the simple
placement of...

st_printf("buffer=%s", buffer);

in front of the existing call to atoi().


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29302


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