This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

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)

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