summaryrefslogtreecommitdiff
path: root/compiler/ghci
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2009-08-01 13:28:29 +0000
committerIan Lynagh <igloo@earth.li>2009-08-01 13:28:29 +0000
commit723f9afa76dc8e80159edede384e0a12f34ed540 (patch)
tree39eab079a876d8952acaa757c02c6cc9d9373633 /compiler/ghci
parent6d92f8127b85a52a472b692c6fa40320432dd5a5 (diff)
downloadhaskell-723f9afa76dc8e80159edede384e0a12f34ed540.tar.gz
If ghci runs out of labels, panic
Diffstat (limited to 'compiler/ghci')
-rw-r--r--compiler/ghci/ByteCodeGen.lhs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/ghci/ByteCodeGen.lhs b/compiler/ghci/ByteCodeGen.lhs
index 4ec8043851..d92e7f867f 100644
--- a/compiler/ghci/ByteCodeGen.lhs
+++ b/compiler/ghci/ByteCodeGen.lhs
@@ -1534,7 +1534,10 @@ recordItblMallocBc a
getLabelBc :: BcM Word16
getLabelBc
- = BcM $ \st -> return (st{nextlabel = 1 + nextlabel st}, nextlabel st)
+ = BcM $ \st -> do let nl = nextlabel st
+ when (nl == maxBound) $
+ panic "getLabelBc: Ran out of labels"
+ return (st{nextlabel = nl + 1}, nl)
getLabelsBc :: Word16 -> BcM [Word16]
getLabelsBc n