www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/06/14/17:59:10

Date: Mon, 14 Jun 1999 17:58:47 -0400
Message-Id: <199906142158.RAA22306@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp-workers AT delorie DOT com
Subject: [erik2 DOT berglund AT telia DOT com: gcc-crash - and a possible solution]
Reply-To: djgpp-workers AT delorie DOT com

------- Start of forwarded message -------
Priority: Normal
X-MSMail-Priority: Normal
X-Priority: 3
To: dj AT delorie DOT com
Cc: erik2 DOT berglund AT telia DOT com
From: "Erik Berglund" <erik2 DOT berglund AT telia DOT com>
Subject: gcc-crash - and a possible solution
Date: Mon, 14 Jun 99 23:23:00 +0100 (DJG)
Content-Type: text/plain; charset="ISO-8859-1"; X-MAPIextension=".TXT"


To DJ Delorie and/or the DJGPP maintainers.

Hi,
I've been using djgpp 2.01 with gcc 2.7.2.1 since november 1996, and it
works really great,
as long as I run gcc in plain DOS (which I mostly do).

gcc-crash
========
However, when I run gcc in a DOS box (in win3.11), I sometimes get a
gcc-crash, like the one below.

Exiting due to signal SIGSEGV
Page fault at eip=000ef7f4, error=0004
eax=000f0454 ebx=002707cc ecx=00292004 edx=00472450 esi=00472450
edi=00000000
ebp=0027012c esp=00270120 program=C:\DJGPP\BIN\CC1.EXE
cs: sel=00a7  base=81049000  limit=fffeffff
ds: sel=00af  base=81049000  limit=fffeffff
es: sel=00af  base=81049000  limit=fffeffff
fs: sel=0087  base=0001e400  limit=0000ffff
gs: sel=00bf  base=00000000  limit=ffffffff
ss: sel=00af  base=81049000  limit=fffeffff

Call frame traceback EIPs:
  0x000ef7f4
  0x00092852
  0x00091797
  0x00027c91
  0x00016d9d
  0x00007a6f
  0x00026d32
  0x000290e2
  0x000efd9a

After that gcc has crashed once, when I try again, I will get similar
gcc-crashes.
Although Windows keeps running, I have to restart Windows to clear
everything up.
Any of these programs may crash: gcc, cpp, cc1, as, ld.

It seems to me that the DPMI provider within win3.11 suddenly becomes
damaged or something,
because it always helps to restart Windows.

I have tried to increase the stack limit up to 4 Mbyte for gcc and friends,
but it didn't help.
I've also run a HIMEM memory test, without any errors.
When I tried gcc 2.8.1 (on Aug 3, 1998), the problem was still there.

A possible solution
===============
>From sections 3.3 and 6.6 in the FAQ, I got this idea of trying to set the
following crt0-bit in gcc:

#include <crt0.h>
int _crt0_startup_flags = _CRT0_FLAGS_UNIX_SBRK;  /* 0x800 */

I didn't want to rebuild the entire gcc, so instead, I patched GCC.EXE at 3
locations,
where this crt0-bit is tested (within crt0.s).
After each "testb $0x8,__crt0_startup_flags+1", I changed "jz" to "jnz",
and it worked fine.

Then I also patched CPP.EXE, CC1.EXE, AS.EXE, LD.EXE, RSXNTDJ-LD.EXE,
all in the same manner.

The good news:
After this patching was done, on June 2, 1999, the gcc-crash did
_completely_ disappear,
and I haven't seen it ever since :D :D.

Reproducing the error
=================
I can reliably reproduce the error, if I switch back to the original
gcc-exefiles.
Please tell me if you want some more information, I could also run
beta-tests etc.

It seems to me that win3.11, and possibly win95, have a bug or "feature" in
their DPMI providers,
which sometimes could make gcc crash. Setting the crt0-bit would hopefully
work around this bug.

Even though my system is now running nice and well, with the patch
implemented, there could be
potential problems for other djgpp-users, so I think the crt0-bit should be
set in gcc, cpp etc,
if you think that's a good idea.

Perhaps "make" and other GNU programs should have this bit set, as well.

One further argument would be that setting this crt0-bit is recommended for
NT
(according to FAQ section 3.3), and then I think it should be set also for
win3.11 and win95, 
so we can use the same gcc-version on all OS's.

Thanks for any help,
Erik Berglund
erik2 DOT berglund AT telia DOT com
------- End of forwarded message -------

- Raw text -


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