*BSD News Article 13540


Return to BSD News archive

Newsgroups: comp.os.386bsd.apps
Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!zaphod.mps.ohio-state.edu!wupost!uunet!mcsun!sun4nl!nlbull!wilg!jos
From: jos@bull.nl (Jos Vos)
Subject: Re: Ghostscript 2.5.2 dies with floating point exceptions
Message-ID: <C4LB1I.3oy@bull.nl>
Keywords: Ghostscript floating point exception
Sender: news@bull.nl (USENET Administrator Bull Netherlands)
Nntp-Posting-Host: spar.bull.nl
Organization: Bull, P.O. Box 22859, NL-1100 DJ Amsterdam, The Netherlands
References: <cproto.733031902@marsh>
Date: Sun, 28 Mar 1993 08:17:41 GMT
Lines: 73

cproto@cs.curtin.edu.au (Computer Protocol) writes:

>I ported Ghostscript 2.5.2 to 386bsd-0.1 (with most patches installed)
>without any problems. If I run the executable it dies with a floating
>point exception. Unfortunately the signal is delivered much after the
>event. Because of this gdb is not reporting the error at the right
>source line. I narrowed the fault down to a single function but when
>I try to single step through it, then the kernel panics. The reason
>might be that two signals are caused at the same time, i.e. the SIGFPE
>and the SIGTRAP.

I have a similar problem on my Bull System V system!  When I first
reported the problem, I was the only one having a problem.

>1. Has anybody found the reason for the FPE in Ghostscript?

I have traced the 68040 assembler code, and it seems that our
(Greenhills) compiler generates some floating-point code at
routine entry-time.

>2. Has anybody fixed the delayed delivery of SIGFPEs?

I now just ignore the SIGFPE and print the # signals when the programs stops:

-----CUT HERE-----
*** gp_unix.c-	Sun Nov  1 11:32:11 1992
--- gp_unix.c	Sun Nov  1 11:53:54 1992
***************
*** 30,45 ****
--- 30,68 ----
  extern FILE *popen();
  extern int pclose();
  
+ #ifdef	BULLBOS2
+ 
+ static int nfpe = 0;
+ 
+ #include <signal.h>
+ 
+ private void
+ handleFPE()
+ {
+     nfpe++;
+     signal(SIGFPE, handleFPE);
+ }
+ 
+ #endif	/* BULLBOS2 */
+ 
  /* Do platform-dependent initialization. */
  void
  gp_init()
  {
+ #ifdef	BULLBOS2
+     signal(SIGFPE, handleFPE);
+ #endif	/* BULLBOS2 */
  }
  
  /* Do platform-dependent cleanup. */
  void
  gp_exit()
  {
+ #ifdef	BULLBOS2
+     if (nfpe > 0)
+ 	fprintf(stderr,
+ 	    "Warning: %d floating point exceptions ignored.\n", nfpe);
+ #endif	/* BULLBOS2 */
  }
  
  /* ------ Date and time ------ */
-----CUT HERE-----
-- 
--    Jos Vos <jos@bull.nl>   (UUCP: ...!{uunet,mcsun,sun4nl}!nlbull!jos)
--    Bull Netherlands, Professional Services, Amsterdam, The Netherlands