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] Fix PR libstdc++/31836 on hppa64-hp-hpux11.11


The following change fixes PR libstdc++/31836.  This is a regression
caused by switching from _GLIBCXX_USE_C99 to _GLIBCXX_HAVE_STRTOLD.
PA HP-UX has strtold, but it is an early version and doesn't conform
to C99 semantics.  This leads to the failure of
27_io/basic_istream/extractors_arithmetic/char/12.cc.

Tested on hppa2.0w-hp-hpux11.11.  Steve Ellcey checked and 11.23 and
11.31 still have the same semantics.  Thus, I don't believe a configure
test is needed.

Ok for trunk?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2007-07-24  John Davind Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	PR libstdc++/31836
	* config/locale/generic/c_locale.cc (__convert_to_v): Don't use
	strtold if _GLIBCXX_HAVE_BROKEN_STRTOLD is defined.
	* config/os/hpux/os_defines.h (_GLIBCXX_HAVE_BROKEN_STRTOLD): Define
	if __hppa__ is defined.

Index: config/locale/generic/c_locale.cc
===================================================================
--- config/locale/generic/c_locale.cc	(revision 126644)
+++ config/locale/generic/c_locale.cc	(working copy)
@@ -149,7 +149,7 @@
       errno = 0;
 #endif
 
-#if defined(_GLIBCXX_HAVE_STRTOLD)
+#if defined(_GLIBCXX_HAVE_STRTOLD) && !defined(_GLIBCXX_HAVE_BROKEN_STRTOLD)
       char* __sanity;
       long double __ld = strtold(__s, &__sanity);
 
Index: config/os/hpux/os_defines.h
===================================================================
--- config/os/hpux/os_defines.h	(revision 126644)
+++ config/os/hpux/os_defines.h	(working copy)
@@ -97,4 +97,12 @@
    are weak; gthread relies on such unsatisfied references being resolved
    to null pointers when weak symbol support is on.  */
 #define _GLIBCXX_GTHREAD_USE_WEAK 0
+
+// The strtold function is obsolete and not C99 conformant on PA HP-UX.
+// It returns plus or minus _LDBL_MAX instead of plus or minus HUGE_VALL
+// if the correct value would cause overflow.  It doesn't handle "inf",
+// "infinity" and "nan".  It is not thread safe. 
+#if defined (__hppa__)
+#define _GLIBCXX_HAVE_BROKEN_STRTOLD 1
 #endif
+#endif


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