From: eplmst AT lu DOT erisoft DOT se (Martin Stromberg) Newsgroups: comp.os.msdos.djgpp Subject: Re: GCC 2.95 global string crashes on 386.. Date: 9 Sep 1999 09:52:48 GMT Organization: Ericsson Erisoft AB, Sweden Lines: 61 Message-ID: <7r801g$in6$1@antares.lu.erisoft.se> References: <199909090422 DOT MAA24404 AT eastgate DOT cyberway DOT com DOT sg> NNTP-Posting-Host: propus-144.lu.erisoft.se X-Newsreader: TIN [version 1.2 PL2] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Rob Kramer (robk AT cyberway DOT com DOT sg) wrote: : Hi all, : For some reason using a global STL 'string' crashes my program if run on a : 386 machine. Take the following testcase: : ----------- : #include : #include : string foo = "bar"; : void main() : { : cout << "test: " << foo << endl; : } : ----------- : Compiled with 'gpp -o test.exe test.cc' (gcc 2.95, bnu 291), this crashes: : ----------- : Exiting due to signal SIGILL : Invalid Opcode at eip=00002052 : eax=ffffffff ebx=00021e4c ecx=00021e4c edx=00021e54 esi=00021cdc : edi=00000003 : ebp=000af9dc esp=000af9c4 program=test.exe : cs: sel=00e7 base=10060000 limit=000bffff : ds: sel=00ef base=10060000 limit=000bffff : es: sel=00ef base=10060000 limit=000bffff : fs: sel=00cf base=000391a0 limit=0000ffff : gs: sel=00ff base=00000000 limit=0010ffff : ss: sel=00ef base=10060000 limit=000bffff : App stack: [000afb50..0002fb50] Exceptn stack: [0002fa2c..0002daec] : Call frame traceback EIPs: : 0x00002052 basic_string, : __default_alloc_template >::Rep::release(void)+18, line 87 of : test.cc : 0x00001e69 basic_string, : __default_alloc_template >::repup(basic_string, __default_alloc_template >::Rep *)+37, : line 147 of test.cc [Klippa, klapp, kluppit rest of traceback.] : The test works fine on 486++. Static member-strings won't work either. I : tried to figure out what the SIGILL-invalid opcode was all about, but my fsdb : keeps crashing on my old 386 if I get near the offending part (haven't got full : DJGPP install there). : This worked on 2.8.1, could someone try to compile this, and see if it works? You could try runnung objdump with the parameters to disassemble on your executable to find out what instruction it is that is illegal. Right, MartinS