delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/09/18:08:21

From: pavenis AT lanet DOT lv
Message-ID: <B0000101000@stargate.astr.lu.lv>
To: "Rob Kramer" <robk AT cyberway DOT com DOT sg>, djgpp AT delorie DOT com
Date: Thu, 9 Sep 1999 16:54:10 +0300
MIME-Version: 1.0
Subject: Re: GCC 2.95 global string crashes on 386..
In-reply-to: <199909090422.MAA24404@eastgate.cyberway.com.sg>
X-mailer: Pegasus Mail for Win32 (v3.12a)
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Confirmed with DJGPP ports of egcs-1.1.2 and gcc-2.95.1 (I don't more 
have gcc-2.95 installed, but that doesn't matter). 2 possible cures:
	- currently use option '-march=i386' on 386, it should help
	- in future: I must rebuild gcc-2.95.1 for target i386-pc-msdosdjgpp

It took about half a year to found first problem when default were 
-march=pentium -mcpu=pentium. Even more: it was default for a rather 
long time in Slackware Linux distribution.

Andris

On 9 Sep 99, at 12:20, Rob Kramer 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 <iostream>
> #include <string>
> 
> 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<char, string_char_traits<char>, 
> __default_alloc_template<false, 0> >::Rep::release(void)+18, line 87 of 
> test.cc
>   0x00001e69 basic_string<char, string_char_traits<char>, 
> __default_alloc_template<false, 0> >::repup(basic_string<char, 
> string_char_traits<char>, __default_alloc_template<false, 0> >::Rep *)+37, 
> line 147 of test.cc
>   0x00001b40 basic_string<char, string_char_traits<char>, 
> __default_alloc_template<false, 0> >::replace(unsigned long, unsigned long, 
> char const *, unsigned long)+348, line 168 of test.cc
>   0x00002185 basic_string<char, string_char_traits<char>, 
> __default_alloc_template<false, 0> >::assign(char const *, unsigned 
> long)+33, line 214 of test.cc
>   0x0000209b basic_string<char, string_char_traits<char>, 
> __default_alloc_template<false, 0> >::assign(char const *)+39, line 216 of 
> test.cc
>   0x00001ef6 basic_string<char, string_char_traits<char>, 
> __default_alloc_template<false, 0> >::basic_string(char const *)+42, line 
> 177 of test.cc
>   0x00001bff ___static_initialization_and_destruction_0+39, line 7 of test.cc
>   0x00002235 global constructors keyed to foo+21, line 3 of test.cc
>   0x0001aa35 ___main+53
>   0x00015c75 ___crt1_startup+141
> -----------
> 
> 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?
> 
> Thanks!
> 
> 	Rob Kramer
> 	robk AT cyberway DOT com DOT sg
> 
> 


- Raw text -


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