public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR libstdc++/31836 on hppa64-hp-hpux11.11
@ 2007-07-25  3:58 John David Anglin
  2007-07-25  9:58 ` Paolo Carlini
  0 siblings, 1 reply; 2+ messages in thread
From: John David Anglin @ 2007-07-25  3:58 UTC (permalink / raw)
  To: gcc-patches, libstdc++

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix PR libstdc++/31836 on hppa64-hp-hpux11.11
  2007-07-25  3:58 [PATCH] Fix PR libstdc++/31836 on hppa64-hp-hpux11.11 John David Anglin
@ 2007-07-25  9:58 ` Paolo Carlini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Carlini @ 2007-07-25  9:58 UTC (permalink / raw)
  To: John David Anglin; +Cc: gcc-patches, libstdc++

John David Anglin wrote:

>Ok for trunk?
>  
>
Yes, I think this is exactly what we agreed to do in the audit trail.

Thanks,
Paolo.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-25  9:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-25  3:58 [PATCH] Fix PR libstdc++/31836 on hppa64-hp-hpux11.11 John David Anglin
2007-07-25  9:58 ` Paolo Carlini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).