|
[ ghc-Bugs-537295 ] div 0 0 give exception / endless loop: msg#00002lang.haskell.glasgow.bugs
Bugs item #537295, was opened at 2002-03-31 01:36 Message generated for change (Comment added) made by simonmar You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=108032&aid=537295&group_id=8032 Category: Runtime System Group: 5.02 >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: geoff (snailtalk) Assigned to: Simon Marlow (simonmar) Summary: div 0 0 give exception / endless loop Initial Comment: There is a problem with the div in ghc, to reproduce: start ghci and type div n 0 where n is any integer (so div 3 0 would work) on a linux box it gives a floating point exception while on a BSD 4.4 box it gives and endless loop using about 87 % of cpu. I have verified this on both the latest release (5.02.2) and 5.02.1. ---------------------------------------------------------------------- >Comment By: Simon Marlow (simonmar) Date: 2003-05-06 08:47 Message: Logged In: YES user_id=48280 No. When the bug was originally closed, the reason given was "Fixed by NOT ignoring SIGFPE." (my emphasis). The divide-by-zero exception was introduced in GHC 5.04.3. ---------------------------------------------------------------------- Comment By: geoff (snailtalk) Date: 2003-05-03 21:37 Message: Logged In: YES user_id=20846 Yes. Because when this bug was closed, it was stated that it was fixed by ignoring SIGFPE (20020702). Therefore, I could only assume that was the fix (sorry I forgot to to strace). Anyway since the signal has nothing to with ghc, let us not worry about it. Is this exception behavior for div new in ghc 5.04.3? Because while this was marked as fixed in the bug tracking system fixed in July '02, and since then 5.04.2 has been released, and 5.04.2 (what I am using now) does not exhibit the same behavior (for both div 0 0 and mod 0 0 case). Loading package haskell98 ... linking ... done. Prelude> div 0 0 zsh: floating point exception ghci $ ghc --version The Glorious Glasgow Haskell Compilation System, version 5.04.2 $ ---------------------------------------------------------------------- Comment By: Simon Marlow (simonmar) Date: 2003-04-28 13:01 Message: Logged In: YES user_id=48280 Could you elaborate? I can't see a bug. On my FreeBSD box I just tried: Prelude> :m +GHC.Base Prelude GHC.Base> I# (0# `divInt#` 0#) zsh: 487 floating point exception (core dumped) ghci I'm not sure what your 'signal' program is supposed to be illustrating: GHC doesn't catch SIGFPE at all so I don't think any behaviour of the SIGFPE handler could possibly be affecting us. Furthermore, GHC 5.04.3 turns normal Int division-by-zero into an exception: Prelude> div 0 0 *** Exception: divide by zero (which is why I had to call the primitive directly above). ---------------------------------------------------------------------- Comment By: geoff (snailtalk) Date: 2003-04-23 19:07 Message: Logged In: YES user_id=20846 It has come to my attention that it is still not fixed in 5.04.2 (my fault for not reading the exact nature of the fix). I assume because for SIGFPE in Unix, the result is undefined after return from the signal handler. Here is some sample code to demonstrate: usage: signal (+|-)u (signal|sigaction) options: +u : uninstall signal in sighandler -u : don't uninstall signal in sighandler signal: install using signal() sigaction: install using sigaction() so for example, signal +u sigaction would install the handler using sigaction and uninstall the signal in the signal handler. The signal is hardcoded to SIGFPE. ---------------------------------------------------------------------- Comment By: Simon Marlow (simonmar) Date: 2002-07-02 11:30 Message: Logged In: YES user_id=48280 Fixed by not ignoring SIGFPE. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=108032&aid=537295&group_id=8032
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [ ghc-Bugs-732850 ] GHCi :i ommits constraints, SourceForge.net |
|---|---|
| Next by Date: | RE: special handling of "Main.hs" contradicts Report, Simon Peyton-Jones |
| Previous by Thread: | [ ghc-Bugs-537295 ] div 0 0 give exception / endless loop, SourceForge.net |
| Next by Thread: | [ ghc-Bugs-732850 ] GHCi :i ommits constraints, SourceForge.net |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |