Bug 17850 - [3.4 regression] bootstrap failure - libstdc++ uses strtold when undeclared
Summary: [3.4 regression] bootstrap failure - libstdc++ uses strtold when undeclared
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.0.0
: P2 critical
Target Milestone: 3.4.3
Assignee: Not yet assigned to anyone
Keywords: build
Depends on:
Reported: 2004-10-05 19:03 UTC by Richard Earnshaw
Modified: 2004-10-07 21:24 UTC (History)
2 users (show)

See Also:
Target: arm-unknown-elf
Known to work:
Known to fail:
Last reconfirmed: 2004-10-07 16:06:11

preprocessed source (67.57 KB, text/plain)
2004-10-05 19:05 UTC, Richard Earnshaw

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Earnshaw 2004-10-05 19:03:34 UTC
Bootstrapping is failing on an arm-unknown-elf cross because of the following error:

/work/rearnsha/gnu/egcs-cross/gcc/xgcc -shared-libgcc -B/work/rearnsha/gnu/egcs-
cross/gcc/ -nostdinc++ -L/work/rearnsha/gnu/egcs-cross/arm-elf/libstdc++-v3/src 
-L/work/rearnsha/gnu/egcs-cross/arm-elf/libstdc++-v3/src/.libs -nostdinc -B/work
/rearnsha/gnu/egcs-cross/arm-elf/newlib/ -isystem /work/rearnsha/gnu/egcs-cross/
arm-elf/newlib/targ-include -isystem /home/rearnsha/gnusrc/egcs-cross/newlib/lib
c/include -B/work/rearnsha/gnu/testinstall/arm-elf/bin/ -B/work/rearnsha/gnu/tes
tinstall/arm-elf/lib/ -isystem /work/rearnsha/gnu/testinstall/arm-elf/include -i
system /work/rearnsha/gnu/testinstall/arm-elf/sys-include -L/work/rearnsha/gnu/e
gcs-cross/ld -I/work/rearnsha/gnu/egcs-cross/arm-elf/libstdc++-v3/include/arm-el
f -I/work/rearnsha/gnu/egcs-cross/arm-elf/libstdc++-v3/include -I/home/rearnsha/
gnusrc/egcs-cross/libstdc++-v3/libsupc++ -O2 -O2 -g -g -O2 -fno-implicit-templat
es -Wall -Wextra -Wwrite-strings -Wcast-qual -fdiagnostics-show-location=once -c
 c++locale.cc -o c++locale.o
c++locale.cc: In function `void std::__convert_to_v(const char*, _Tv&, std::_Ios
_Iostate&, int* const&) [with _Tv = long double]':
c++locale.cc:123: error: 'strtold' was not declared in this scope
gnumake[3]: *** [c++locale.lo] Error 1

This was probably introduced by the following patch

2004-10-03  Roger Sayle  <roger@eyesopen.com>

        * config/locale/generic/c_locale.cc (__convert_to_v): Use
        _GLIBCXX_HAVE_STRTOF instead _GLIBCXX_USE_C99 to check for strtof.
        Likewise, use _GLIBCXX_HAVE_STRTOLD instead of _GLIBCXX_USE_C99
        to check for presence of strtold.
Comment 1 Richard Earnshaw 2004-10-05 19:05:17 UTC
Created attachment 7288 [details]
preprocessed source
Comment 2 Andrew Pinski 2004-10-05 19:16:01 UTC
A 3.4 regression also if it was caused by that patch.
Comment 3 Richard Earnshaw 2004-10-05 19:21:26 UTC
As far as I can see, I think the problem is in configure.ac, where we
automatically assume that newlib has strtold().  This is false AFAICT, newlib
has _strtold, but it doesn't have strtold.

Comment 4 roger 2004-10-05 20:58:11 UTC
Richard does the "obvious" one line fix to configure.ac restore bootstrap for
you?  It looks like my cygwin (a newlib target) doesn't even have _strtold.

Index: configure.ac
RCS file: /cvs/gcc/gcc/libstdc++-v3/configure.ac,v
retrieving revision 1.27
diff -c -3 -p -r1.27 configure.ac
*** configure.ac        5 Oct 2004 05:02:58 -0000       1.27
--- configure.ac        5 Oct 2004 20:55:02 -0000
*************** else
*** 194,200 ****

      # AC_FUNC_MMAP

--- 194,199 ----
Comment 5 Richard Earnshaw 2004-10-06 00:04:58 UTC
Yes, I think that probably is the best solution.  I looked at changing the entry
to HAVE__STRTOLD and adding the other related glue to handle that, but that
doesn't work (or I've missed something else) because there's no declartion of
_strtold in any of the header files.
Comment 6 Benjamin Kosnik 2004-10-07 03:37:55 UTC
Richard note the remappings in c++config.h:

#if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD)
# define strtold _strtold

I thought _strtold was defined in the newlib binary.

Comment 7 Benjamin Kosnik 2004-10-07 03:40:18 UTC
... of course, if newlib doesn't have strtold or any of the _strtold or
__strtold or whatever, then the cross config bits for newlib shouldn't say that
it does.

Comment 8 Richard Earnshaw 2004-10-07 08:32:13 UTC
Subject: Re:  [3.4/4.0 regression] bootstrap failure -
	libstdc++ uses strtold when undeclared

On Thu, 2004-10-07 at 04:37, bkoz at gcc dot gnu dot org wrote:
> ------- Additional Comments From bkoz at gcc dot gnu dot org  2004-10-07 03:37 -------
> Richard note the remappings in c++config.h:
> #if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD)
> # define strtold _strtold
> #endif
> I thought _strtold was defined in the newlib binary.

But no declaration in the headers (at least, not in my copy), so we
can't use it in C++ unless there's some mechanism for making libstdc++
configury generate a declaration for us... :-( 

Further, Roger says that even that isn't in his copy of Cygwin...

Comment 9 Benjamin Kosnik 2004-10-07 15:39:27 UTC
There is no newlib definition for strtold. Thus, this patch should be applied:

Comment 10 CVS Commits 2004-10-07 15:52:50 UTC
Subject: Bug 17850

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2004-10-07 15:52:43

Modified files:
	libstdc++-v3   : ChangeLog configure.ac configure 

Log message:
	PR libstdc++/17850
	* configure.ac: Newlib does not provide strtold.
	* configure: Regenerate.


Comment 11 Andrew Pinski 2004-10-07 16:06:10 UTC
Comment 13 Andrew Pinski 2004-10-07 21:24:20 UTC