Bug 35667 - HP-UX 10 has broken strtod
Summary: HP-UX 10 has broken strtod
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 35666 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-22 18:01 UTC by John David Anglin
Modified: 2014-03-23 00:07 UTC (History)
2 users (show)

See Also:
Host: hppa1.1-hp-hpux10.20
Target: hppa1.1-hp-hpux10.20
Build: hppa1.1-hp-hpux10.20
Known to work:
Known to fail: 4.3.0, 4.4.0, 4.5.0
Last reconfirmed: 2009-03-28 08:55:37


Attachments
pr35667.d (3.37 KB, text/plain)
2009-03-28 18:57 UTC, dave
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2008-03-22 18:01:24 UTC
Executing on host: /xxx/gnu/gcc/objdir/gcc/testsuite/gfortran/../../gfortran -B/xxx/gnu/gcc/objdir/gcc/testsuite/gfortran/../../ /xxx/gnu/gcc/gcc/gcc/testsuite/gfortran.dg/nan_3.f90   -O0  -fno-range-check  -L/xxx/gnu/gcc/objdir/hppa1.1-hp-hpux10.20/./libgfortran/.libs -L/xxx/gnu/gcc/objdir/hppa1.1-hp-hpux10.20/./libgfortran/.libs -L/xxx/gnu/gcc/objdir/hppa1.1-hp-hpux10.20/./libiberty  -lm   -o ./
nan_3.exe    (timeout = 600)
PASS: gfortran.dg/nan_3.f90  -O0  (test for excess errors)Setting LD_LIBRARY_PATH to .:/xxx/gnu/gcc/objdir/hppa1.1-hp-hpux10.20/./libgfortran/.libs:/xxx/gnu/gcc/objdir/hppa1.1-hp-hpux10.20/./libgfortran/.libs:/xxx/gnu/gcc/objdir/gcc:.:/xxx/gnu/gcc/objdir/hppa1.1-hp-hpux10.20/./libgfortran/.libs:/xxx/gnu/gcc/objdir/hppa1.1-hp-hpux10.20/./libgfortran/.libs:/xxx/gnu/gcc/objdir/g
cc
FAIL: gfortran.dg/nan_3.f90  -O0  execution test
Comment 1 John David Anglin 2008-03-22 18:19:06 UTC
Breakpoint 5, MAIN__ ()
    at /xxx/gnu/gcc/gcc/gcc/testsuite/gfortran.dg/nan_3.f90:17
17        if (.not.isnan(r)) call abort()
(gdb) p r
$1 = 0
(gdb) ptype r
type = real(kind=4)
(gdb) p/f r
$2 = 0
(gdb) step
_gfortran_abort () at ../../../gcc/libgfortran/intrinsics/abort.c:38
38        close_units ();
Comment 2 John David Anglin 2008-03-22 20:12:50 UTC
The problem is the use of strtod in convert_real.  Unfortunately, strtod
does not return correct values for nan, inf and infinity on hpux10.  This
was fixed in hpux11.
Comment 3 Jerry DeLisle 2008-03-22 22:35:02 UTC
*** Bug 35666 has been marked as a duplicate of this bug. ***
Comment 4 Francois-Xavier Coudert 2009-03-28 08:55:37 UTC
The solution to this issue would be to detect a broken strtod() (or strtof() or strtold()) in libgfortran configury, and write a wrapper checking for infinities and nans before calling the system's strtod().

Very low priority issue because HP-UX 10 is probably not that common any more (HP-UX 11 was released 12 years ago), unless some other target is affected.
Comment 5 dave 2009-03-28 18:57:18 UTC
Subject: Re:  HP-UX 10 has broken strtod

On Sat, 28 Mar 2009, fxcoudert at gcc dot gnu dot org wrote:

> 
> 
> ------- Comment #4 from fxcoudert at gcc dot gnu dot org  2009-03-28 08:55 -------
> The solution to this issue would be to detect a broken strtod() (or strtof() or
> strtold()) in libgfortran configury, and write a wrapper checking for
> infinities and nans before calling the system's strtod().

Just for the record, I've attached my last version of a change to do this.
There was some discussion of this in the following thread:
http://gcc.gnu.org/ml/fortran/2008-04/msg00000.html

I ran out of time to work on it when the new register allocator was added
and the hppa port broke.

Dave
Comment 6 dave 2009-03-28 18:57:18 UTC
Created attachment 17556 [details]
pr35667.d
Comment 7 John David Anglin 2011-03-19 17:25:21 UTC
Author: danglin
Date: Sat Mar 19 17:25:18 2011
New Revision: 171182

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171182
Log:
	PR fortran/35667
	* io/io.h (convert_infnan): Declare.
	* io/read.c (convert_infnan): New.
	(read_f): Use convert_infnan to convert INFs and NANs.
	* list_read.c (parse_real, read_real): Likewise.


Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/io.h
    trunk/libgfortran/io/list_read.c
    trunk/libgfortran/io/read.c
Comment 8 Francois-Xavier Coudert 2013-12-09 10:01:48 UTC
Was that fixed with John's commit?
Comment 9 dave.anglin 2013-12-09 20:40:26 UTC
On 12/9/2013 5:01 AM, fxcoudert at gcc dot gnu.org wrote:
> Was that fixed with John's commit?
I think so.  I believe this was left open because the patch wasn't
back ported.

I could confirm but that would take awhile.

Dave
Comment 10 Dominique d'Humieres 2014-03-23 00:07:45 UTC
> > Was that fixed with John's commit?
> I think so.  I believe this was left open because the patch wasn't
> back ported.

The patch was committed in 4.6 or 4.7 (3 years ago), so the back porting issue in now moot. Closing as FIXED.