From 723f9afa76dc8e80159edede384e0a12f34ed540 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sat, 1 Aug 2009 13:28:29 +0000 Subject: [PATCH] If ghci runs out of labels, panic --- compiler/ghci/ByteCodeGen.lhs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/ghci/ByteCodeGen.lhs b/compiler/ghci/ByteCodeGen.lhs index 4ec8043..d92e7f8 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 -- 1.7.10.4