delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/01/04/09:31:12

From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp,gnu.g++.help
Subject: Re: Problem with basic_string
Date: Sat, 04 Jan 2003 13:18:33 +0000
Lines: 101
Message-ID: <3E16DF29.5120A4FF@phekda.freeserve.co.uk>
References: <av6mgq$cjiq1$1 AT ID-79865 DOT news DOT dfncis DOT de>
NNTP-Posting-Host: 62.136.92.124
Mime-Version: 1.0
X-Trace: news5.svr.pol.co.uk 1041690326 9975 62.136.92.124 (4 Jan 2003 14:25:26 GMT)
NNTP-Posting-Date: 4 Jan 2003 14:25:26 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

Alex Vinokur wrote:
> I have some problem with basic_string.
> What is wrong ?

It seems that the DJGPP port of g++ should complain. I suspect you've found a
bug in the template code that was fixed in g++ > 3.1.

> ======================
> Windows 2000
>   --------------------
>   MinGW 2.0.0.-2
>   GNU g++ version 3.2
>   --------------------
>   DJGPP 2.03
>   GNU gpp version 3.1
> ======================

Have you tried gpp version 3.2 (or 3.2.1) for DJGPP?

> ========= C++ code : BEGIN =========
> // File t1.cpp
> #include <string>
> using namespace std;
> 
> int main ()
> {
> basic_string<string> bs1;
>   bs1 += "ABC";
> 
>   return 0;
> }
> ========= C++ code : END ===========
> 
> ========= [ MinGW ] Compilation : BEGIN =========
> 
> % g++ -W -Wall t1.cpp -o m.exe
> 
> C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccMBaaaa.o(.text$_ZNSbISsSt11char_traitsISsES
> aISsEE7replaceEN9__gnu_cxx17__normal_iteratorIPSsS2_EES6_jSs+0xcc):t1.cpp: undef
> ined reference to `std::char_traits<std::string>::assign(std::string*, unsigned,
>  std::string)'
> C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccMBaaaa.o(.text$_ZNSbISsSt11char_traitsISsES
> aISsEE4_Rep8_M_cloneERKS1_j+0xaa):t1.cpp: undefined reference to `std::char_trai
> ts<std::string>::copy(std::string*, std::string const*, unsigned)'
> C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccMBaaaa.o(.text$_ZNSbISsSt11char_traitsISsES
> aISsEE9_M_mutateEjjj+0x15a):t1.cpp: undefined reference to `std::char_traits<std
> ::string>::copy(std::string*, std::string const*, unsigned)'
> C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccMBaaaa.o(.text$_ZNSbISsSt11char_traitsISsES
> aISsEE9_M_mutateEjjj+0x191):t1.cpp: undefined reference to `std::char_traits<std
> ::string>::copy(std::string*, std::string const*, unsigned)'
> C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccMBaaaa.o(.text$_ZNSbISsSt11char_traitsISsES
> aISsEE9_M_mutateEjjj+0x2ae):t1.cpp: undefined reference to `std::char_traits<std
> ::string>::move(std::string*, std::string const*, unsigned)'
> 
> ========= [ MinGW ] Compilation : END ===========
> 
> ========= [ DJGPP ] Compilation & Run : BEGIN =========
> 
> % gpp -W -Wall t1.cpp -o d.exe // No errors
> 
> % d.exe
> 
> Exiting due to signal SIGSEGV
> General Protection Fault at eip=0001a0d4
> eax=ffffffff ebx=000426d0 ecx=2e6e6f67 edx=2e6e6f73 esi=00050a18 edi=00042664
> ebp=0058fe18 esp=0058fde0 program=C:\__TMP_0\D.EXE
> cs: sel=01a7  base=017c0000  limit=0058ffff
> ds: sel=01af  base=017c0000  limit=0058ffff
> es: sel=01af  base=017c0000  limit=0058ffff
> fs: sel=017f  base=000056e0  limit=0000ffff
> gs: sel=01bf  base=00000000  limit=0010ffff
> ss: sel=01af  base=017c0000  limit=0058ffff
> App stack: [00590000..00510000]  Exceptn stack: [000447b0..00042870]
> 
> Call frame traceback EIPs:
>   0x0001a0d4
>   0x00018424
>   0x00017ecd
>   0x00017b5a
>   0x0001794b
>   0x0000163b
>   0x00004ee8
> 
> ========= [ DJGPP ] Compilation & Run : END ===========

Try building with debug and then posting what symify shows:

    symify C:\__TMP_0\D.EXE

You may need to use bfdsymify in of symify depending on which debug format you
use, which you can get by installing a distribution of gdb 5.

Please post the output of symify, when you get backtraces on segfaults. They
help a lot with debugging.

Regards,

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019