From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29207 invoked by alias); 31 Oct 2006 14:14:51 -0000 Received: (qmail 29135 invoked by uid 48); 31 Oct 2006 14:14:37 -0000 Date: Tue, 31 Oct 2006 14:14:00 -0000 Message-ID: <20061031141437.29134.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libfortran/29302] nan_inf_fmt.f90 segfaults on Darwin PPC starting with Xcode 2.4 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "howarth at nitro dot med dot uc dot edu" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-10/txt/msg02697.txt.bz2 List-Id: ------- 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