Mail Archives: djgpp-workers/1999/05/06/05:37:20
You might remember the problem with a program that crashes due to SIGFPE
on Windows: the next program you run crashes immediately at startup.
I have found that adding a call to `_clear87' before exiting prevents
this from happening, at least in Windows 95 and in those cases I tested.
Are there any downsides to calling `_clear87' during the exit code in
general and after an FP exception in particular? If not, I think we
should check in this change. The modified version of `_exit' (from
dpmiexcp.c) is attached below, for your reference, with the addition of
the call to `_clear87' as the first thing it does.
Thanks in advance for any feedback.
void __attribute__((noreturn))
_exit(int status)
{
_clear87 ();
/* We need to restore hardware interrupt handlers even if somebody calls
`_exit' directly, or else we crash the machine in nested programs.
We only toggle the handlers if the original keyboard handler is intact
(otherwise, they might have already toggled them). */
if (__djgpp_old_kbd.offset32 == kbd_ori.offset32
&& __djgpp_old_kbd.selector == kbd_ori.selector)
__djgpp_exception_toggle ();
__exit (status);
}
- Raw text -