home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / sun / misc / 3373 < prev    next >
Encoding:
Internet Message Format  |  1992-07-28  |  1.8 KB

  1. Xref: sparky comp.sys.sun.misc:3373 comp.unix.wizards:3338
  2. Newsgroups: comp.sys.sun.misc,comp.unix.wizards
  3. Path: sparky!uunet!shearson.com!news
  4. From: pmetzger@shearson.com (Perry E. Metzger)
  5. Subject: getting SIGFPE working right
  6. Message-ID: <1992Jul28.203716.14289@shearson.com>
  7. Sender: news@shearson.com (News)
  8. Organization: Lehman Brothers
  9. Date: Tue, 28 Jul 1992 20:37:16 GMT
  10. Lines: 31
  11.  
  12. Hello, all.
  13.  
  14. This is an odd one. After years of writing C code that never cared a
  15. damn about arithmetic exceptions, I suddenly found myself caring and
  16. vaguely remembered some signal that handled this. A quick look at the
  17. man page for sigvec revealed SIGFPE, which is supposed to catch
  18. floating point and some integer exceptions. So far, so good, only, I
  19. found at first that it didn't work. Some study found the -fnonstd flag
  20. for the compiler (SunOS 4.1.1, standard compiler, by the way) which
  21. seems to make it work for at least some floating point exceptions, and
  22. SIGFPE seems to trigger fine on divide by zero in the integer space.
  23. So far, so good.  Only, I'm still missing one case. Quoting from the
  24. sigvec manpage...
  25.  
  26.      SPARC codes:[...]
  27.        Integer overflow                   SIGFPE  FPE_INTOVF_TRAP
  28.  
  29. Only, I can't for the life of me figure out the magic needed to get
  30. the compiler/everything else to actually send me this signal for
  31. integer overflow; I'd presume some special magic is needed as most of
  32. the time no one would care about overflow in C. Sadly, none of this
  33. stuff is properly documented, at least it isn't properly documented
  34. anywhere I've looked. Any clues, folks? And while I'm at it, is
  35. -fnonstd the right way to get SIGFPE to work, and any clue how to get
  36. all this running with gcc?
  37.  
  38. --
  39. Perry Metzger        pmetzger@shearson.com
  40. --
  41.           Just say "NO!" to death and taxes.
  42.              Extropian and Proud.
  43.