Skip to content

GHCi + large Integer arithmetic + Ctrl-C = bad

Now detected and mostly repeatable on x86, not just powerpc.

$ ghci
Prelude> product [1..50000]
[press control-C repeatedly, without pausing the assault,
  until the following line appears:]
3347320509<interactive>: exception :: GhcException
[sometimes this line appears instead, in which case try
  again until GhcException reproduced:
  3347320509Interrupted.]

The exact number of digits printed can vary - they ARE the initial digits of 50000! (factorial), by the way. The GhcException can happen whether this expression is the first thing to be entered into the ghci prompt session or not. Once it happens, the terminal is rather frozen, although control-Z to suspend ghci and regain a shell prompt, seems to make the terminal usable again, and kill (ghc's pid) or kill -9 (ghc's pid) (I needed the -9/-KILL once and not another time I tried, inexplicably) also returns from ghci to my shell.

Even when not so many control-C's are used and it just says Interrupted, ghci takes an awfully long time before returning to the ghci prompt, which is undesirable.

Trac metadata
Trac field Value
Version 6.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture Multiple
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information