building libstdc++-v3 with gcc 2.95.2 fixed, I hope.

llewelly@dbritsch.dsl.xmission.com llewelly@dbritsch.dsl.xmission.com
Thu May 11 02:27:00 GMT 2000


I got libstdc++-v3 to build with gcc-2.95.2, and I think I found a few
  bugs doing it. I am including a patch against the 2000-05-01
  snapshot. 

With this patch, gcc-2.96 20000501 --enable-libstdcxx-v3
  --enable-shared --enable-threads=posix passes all of the libstdc++
  testsuite: 
  pass/fail results:  69/0, WIN WIN

  gcc 2.95.2 --enable-shared --enable-threads=posix has 3 failures :-( 
    22_locale/ctype.cc
    26_numerics/buggy_complex.cc
    26_numerics/complex_inserters_extractors.cc

  (tested on i686-pc-linux-gnu, glibc-2.1.2, binutils-2.9.5.0.41)

  I think these failures are unrelated to this patch.
        
This patch is intended to fix 3 bugs.

  (1) Bad tr commands in src/Makefile.am were stripping out digits
      when they should not have been, causing 
      [w]string[REP4I,REPIIPP2,CONPPF2,COMPARE2,COMPAREP2].lo to be
      built with the wrong -D defines. For example:

        src/Makefile.am contains the following rule :
        stringMAIN.lo \ 
        stringCTORNC.lo \
        [sniped a bunch of .lo files ...]
        stringREP4I.lo \
        stringREPIIPP.lo \
        stringREPIIPP2.lo \
        [sniped more .lo files]
        stringCONPPF.lo \
        stringCONPPF2.lo \
        [sniped more .lo files]
        stringCOMPARE.lo \
        stringCOMPARE2.lo \
        stringCOMPAREP.lo \
        stringCOMPAREP2.lo \
        [sniped more .lo files]
        stringEQ.lo : string-inst.cc
                $(LTCXXCOMPILE) -fimplicit-templates \
                -c -D`echo $@ | tr -dc 'A-Z'` $< -o $@

        On my i686-pc-linux-gnu:
        {~}echo stringREPIIPP2.lo | tr -dc 'A-Z'
        REPIIPP{~}tr --version
        tr (GNU textutils) 2.0
        Written by Jim Meyering.
        [snip]

      So stringREPIIPP2.lo was built with -DREPIIPP, making it a
        duplicate of stringREPIIPP.lo, and the method instantiation
        that was supposed to be in stringREPIIPP2.lo was never
        instantiated.

      gcc 2.95.2 generates T symbols for explicit instantiations,
        so this caused 8 of the 10 duplicate definition errors I
        reported. 

      gcc 2.96 20000501 generates weak symbols for explicit template
        instantiations, so no duplicate definition errors were caused by
        this bug, but compiling with -fno-implicit-templates would
        reveal missing instantiations. (I can code up test cases for
        missing instantiations if needed.)

      This patch changes the faulty trs (there are 4 of them) to
        'tr -dc '0-9A-Z'' 

  (2) One of the duplicate def errors was caused by the following code
      in src/string-inst.cc :
      
        [snip]
        #ifdef CTORNC
          template 
            S::basic_string(S::size_type, C, S::allocator_type const&);
        #endif

        [snip]

        #ifdef CTORDUPAL
          template 
            S::basic_string(
              S::size_type, C, S::allocator_type const&);
        #endif

        [snip]

      I am not sure what was intended here, but since all of the
        basic_string<> constructors were being instantiated already, I
        eliminated the duplicate.

  (3) An second template keyword in the instantiation of a member
      template is an error. This was hidden because the code was
      between #ifdef REP4I #endif, and the module it was in was built
      with -DREPI (making the module empty!), due to the faulty tr
      command noted above.

Please note that this patch does *not* include a regenerated
  Makefile.in .

  My automake did a lot of seemingly unecessary re-arranging of
  text. (I couldn't figure out why it kept changing libio/Makefile.in,
  for example.)

ChangeLog entry:

2000-05-11  LLeweLLyn Reese  <llewelly@dbritsch.dsl.xmission.com>

        * src/Makefile.am: Fix tr commands.
        * src/Makefile.am: Remove references to [w]stringCTORDUPAL.[lo,cc]
        * src/string-inst.cc: Remove extra instation of
          S::basic_string(S::size_type, C, S::allocator_type const&);
        * src/string-inst.cc: Remove extra template keyword.
        
diff --context --recursive old/egcs-20000501/libstdc++-v3/src/Makefile.am new/egcs-20000501/libstdc++-v3/src/Makefile.am
*** old/egcs-20000501/libstdc++-v3/src/Makefile.am	Thu Apr 27 20:50:55 2000
--- new/egcs-20000501/libstdc++-v3/src/Makefile.am	Thu May 11 01:24:56 2000
***************
*** 171,177 ****
  string_sources = \
  	stringMAIN.cc stringCTORNC.cc stringCTORAL.cc \
  	stringCTORCPR.cc stringCTORCPRAL.cc stringCTORPRAL.cc \
! 	stringCTORPAL.cc stringCTORDUPAL.cc stringCTORPP.cc stringCTORII.cc \
  	stringMUTATE.cc stringRESERVE.cc \
  	stringSWAP.cc stringSLOP.cc \
  	stringRESIZE.cc stringAPPCOPY.cc stringAPPCPR.cc stringAPPPR.cc \
--- 171,177 ----
  string_sources = \
  	stringMAIN.cc stringCTORNC.cc stringCTORAL.cc \
  	stringCTORCPR.cc stringCTORCPRAL.cc stringCTORPRAL.cc \
! 	stringCTORPAL.cc stringCTORPP.cc stringCTORII.cc \
  	stringMUTATE.cc stringRESERVE.cc \
  	stringSWAP.cc stringSLOP.cc \
  	stringRESIZE.cc stringAPPCOPY.cc stringAPPCPR.cc stringAPPPR.cc \
***************
*** 190,196 ****
  wstring_sources = \
  	wstringMAIN.cc wstringCTORNC.cc wstringCTORAL.cc \
  	wstringCTORCPR.cc wstringCTORCPRAL.cc wstringCTORPRAL.cc \
! 	wstringCTORPAL.cc wstringCTORDUPAL.cc wstringCTORPP.cc \
  	wstringCTORII.cc \
  	wstringMUTATE.cc wstringRESERVE.cc \
  	wstringSWAP.cc wstringSLOP.cc \
--- 190,196 ----
  wstring_sources = \
  	wstringMAIN.cc wstringCTORNC.cc wstringCTORAL.cc \
  	wstringCTORCPR.cc wstringCTORCPRAL.cc wstringCTORPRAL.cc \
! 	wstringCTORPAL.cc wstringCTORPP.cc \
  	wstringCTORII.cc \
  	wstringMUTATE.cc wstringRESERVE.cc \
  	wstringSWAP.cc wstringSLOP.cc \
***************
*** 293,299 ****
  stringCTORCPRAL.lo \
  stringCTORPRAL.lo \
  stringCTORPAL.lo \
- stringCTORDUPAL.lo \
  stringCTORPP.lo \
  stringCTORII.lo \
  stringMUTATE.lo \
--- 293,298 ----
***************
*** 343,349 ****
  stringSCOPY.lo \
  stringEQ.lo : string-inst.cc
  	$(LTCXXCOMPILE) -fimplicit-templates \
! 	-c -D`echo $@ | tr -dc 'A-Z'` $< -o $@
  
  wstringMAIN.lo \
  wstringCTORNC.lo \
--- 342,348 ----
  stringSCOPY.lo \
  stringEQ.lo : string-inst.cc
  	$(LTCXXCOMPILE) -fimplicit-templates \
! 	-c -D`echo $@ | tr -dc '0-9A-Z'` $< -o $@
  
  wstringMAIN.lo \
  wstringCTORNC.lo \
***************
*** 352,358 ****
  wstringCTORCPRAL.lo \
  wstringCTORPRAL.lo \
  wstringCTORPAL.lo \
- wstringCTORDUPAL.lo \
  wstringCTORPP.lo \
  wstringCTORII.lo \
  wstringMUTATE.lo \
--- 351,356 ----
***************
*** 402,408 ****
  wstringSCOPY.lo \
  wstringEQ.lo : string-inst.cc
  	$(LTCXXCOMPILE) -fimplicit-templates \
! 	-c -D`echo $@ | tr -dc 'A-Z'` -DC=wchar_t $< -o $@
  
  stringMAIN.o \
  stringCTORNC.o \
--- 400,406 ----
  wstringSCOPY.lo \
  wstringEQ.lo : string-inst.cc
  	$(LTCXXCOMPILE) -fimplicit-templates \
! 	-c -D`echo $@ | tr -dc '0-9A-Z'` -DC=wchar_t $< -o $@
  
  stringMAIN.o \
  stringCTORNC.o \
***************
*** 411,417 ****
  stringCTORCPRAL.o \
  stringCTORPRAL.o \
  stringCTORPAL.o \
- stringCTORDUPAL.o \
  stringCTORPP.o \
  stringCTORII.o \
  stringMUTATE.o \
--- 409,414 ----
***************
*** 461,467 ****
  stringSCOPY.o \
  stringEQ.o : string-inst.cc
  	$(CXXCOMPILE) -fimplicit-templates \
! 	-c -D`echo $@ | tr -dc 'A-Z'` $< -o $@
  
  wstringMAIN.o \
  wstringCTORNC.o \
--- 458,464 ----
  stringSCOPY.o \
  stringEQ.o : string-inst.cc
  	$(CXXCOMPILE) -fimplicit-templates \
! 	-c -D`echo $@ | tr -dc '0-9A-Z'` $< -o $@
  
  wstringMAIN.o \
  wstringCTORNC.o \
***************
*** 470,476 ****
  wstringCTORCPRAL.o \
  wstringCTORPRAL.o \
  wstringCTORPAL.o \
- wstringCTORDUPAL.o \
  wstringCTORPP.o \
  wstringCTORII.o \
  wstringMUTATE.o \
--- 467,472 ----
***************
*** 520,523 ****
  wstringSCOPY.o \
  wstringEQ.o : string-inst.cc
  	$(CXXCOMPILE) -fimplicit-templates \
! 	-c -D`echo $@ | tr -dc 'A-Z'` -DC=wchar_t $< -o $@
--- 516,523 ----
  wstringSCOPY.o \
  wstringEQ.o : string-inst.cc
  	$(CXXCOMPILE) -fimplicit-templates \
! 	-c -D`echo $@ | tr -dc '0-9A-Z'` -DC=wchar_t $< -o $@
! 
! 
! 
! 
diff --context --recursive old/egcs-20000501/libstdc++-v3/src/string-inst.cc new/egcs-20000501/libstdc++-v3/src/string-inst.cc
*** old/egcs-20000501/libstdc++-v3/src/string-inst.cc	Tue Apr 25 00:39:48 2000
--- new/egcs-20000501/libstdc++-v3/src/string-inst.cc	Thu May 11 00:13:29 2000
***************
*** 98,109 ****
        C const*, S::allocator_type const&);
  #endif
  
- #ifdef CTORDUPAL
-   template 
-     S::basic_string(
-       S::size_type, C, S::allocator_type const&);
- #endif
- 
  #ifdef CTORPP
    template 
      S::basic_string
--- 98,103 ----
***************
*** 222,228 ****
  #endif
  
  #ifdef REP4I
!   template 
    template 
      S& 
      S::_M_replace<S::const_iterator>
--- 216,224 ----
  #endif
  
  #ifdef REP4I
!   //Only one template keyword allowed here. 
!   //  See core issue #46 (NAD)
!   //  http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_closed.html#46
    template 
      S& 
      S::_M_replace<S::const_iterator>



More information about the Libstdc++ mailing list