www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/12/12:19:15

Date: Sun, 12 Jul 1998 19:17:48 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "Peter J. Farley III" <pjfarley AT banet DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: SIGFPE causes bash 1.14.7 Invalid Page Exception
In-Reply-To: <35a42993.4698410@news1.banet.net>
Message-ID: <Pine.SUN.3.91.980712191726.27114M-100000@is>
MIME-Version: 1.0

On Thu, 9 Jul 1998, Peter J. Farley III wrote:

> [Posted and mailed to bash maintainer]

I don't think this problem has anything to do with Bash.  See below.

> I have been trying to configure and build perl 5.004 from the DJGPP
> sources (perl54s.zip), but when the Configure script tries to check
> whether large floats can be cast to int32 by gcc, the resulting
> program generates a SIGFPE and then bash crashes with a Win95 Invalid
> Page exception, address 00F7:3374, interrupts in service 2, 13.

This is a known problem, but the reason is a subtle bug in the
go32-v2.exe program.  Here's why.

When the Perl Configure script runs, it compiles several test programs
and runs them.  GCC 2.7.2.1, which you are using, when invoked like
this:
	 gcc -o foo foo.c

produces a raw COFF file `foo' and a DOS executable `foo.exe'.  When
the script then invokes `foo', Bash first finds the raw COFF file
`foo', and runs it.  The way to run a raw COFF executable is via
go32-v2.exe (the library functions like `system' and `spawnXX' do that
automatically).

However, stock go32-v2 from djdev201.zip has a bug: it doesn't revert
the exception handlers to their original state before running the COFF
image.  go32-v2 runs the COFF image by longjmp-ing into its
startup code, so the execution thread never gets back to go32-v2.
When the COFF image starts, it saves the exception handlers (which
point to go32-v2 code) and restores them on exit.  But go32-v2's exit
code never gets to run, so when go32-v2's exits, the exception
handlers point into the void.  That's why Bash crashes right after it.

You can have the same effect if you press a random key (like Ctrl or
Shift) several times during the time Configure runs.  Sooner or later,
you will see a nasty crash.

This bug will be solved in DJGPP v2.02.  Until it's released, the
solution is to get a patched go32-v2.  If you want, I can mail you a
patched source which you will need to compile.

- Raw text -


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