This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Libstdc++-v3 vs -fno-unit-at-a-time
- From: Paolo Carlini <pcarlini at suse dot de>
- To: gcc at gcc dot gnu dot org
- Cc: Jan Hubicka <jh at suse dot cz>, gcc-bugs at gcc dot gnu dot org, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 02 Dec 2003 01:04:53 +0100
- Subject: Libstdc++-v3 vs -fno-unit-at-a-time
Hi everyone,
I'm trying to understand more about some weird problems I'm currently
seeing: basically, on x86-linux, at least, if the library is compiled
"-O2 -g" (the default) spurious failures appear changing unrelated parts
of it, for instance 21_strings/basic_string/find/char/3.c if I apply
the *totally* unrelated attached patch...
In the process, I have just noticed that a library built
"-O2 -fno-unit-at-a-time -g" is *totally* broken: most of the tests in
the testsuite fail to compile with this ICE:
internal compiler error: in cgraph_finalize_compilation_unit, at
cgraphunit.c:387
What's going on?
Paolo.
diff -prN libstdc++-v3-orig/include/bits/locale_facets.tcc libstdc++-v3/include/bits/locale_facets.tcc
*** libstdc++-v3-orig/include/bits/locale_facets.tcc Sun Nov 30 12:33:23 2003
--- libstdc++-v3/include/bits/locale_facets.tcc Mon Dec 1 23:34:28 2003
*************** namespace std
*** 1964,1984 ****
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
size_t __i = 0;
! string __digits;
! for (; __i < 4 && __beg != __end
&& __ctype.is(ctype_base::digit, *__beg); ++__beg, ++__i)
! __digits += __ctype.narrow(*__beg, 0);
if (__i == 2 || __i == 4)
! {
! long __l;
! std::__convert_to_v(__digits.c_str(), __l, __err,
! _S_get_c_locale());
! if (!(__err & ios_base::failbit) && __l <= INT_MAX)
! {
! __l = __i == 2 ? __l : __l - 1900;
! __tm->tm_year = static_cast<int>(__l);
! }
! }
else
__err |= ios_base::failbit;
if (__beg == __end)
--- 1964,1975 ----
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
size_t __i = 0;
! int __value = 0;
! for (; __beg != __end && __i < 4
&& __ctype.is(ctype_base::digit, *__beg); ++__beg, ++__i)
! __value = __value * 10 + (__ctype.narrow(*__beg, 0) - '0');
if (__i == 2 || __i == 4)
! __tm->tm_year = __i == 2 ? __value : __value - 1900;
else
__err |= ios_base::failbit;
if (__beg == __end)