From b9bef8d6cdb65008b10ee6d2a8638ad5575465da Mon Sep 17 00:00:00 2001
From: simonm <unknown>
Date: Tue, 27 Apr 1999 15:21:32 +0000
Subject: [PATCH] [project @ 1999-04-27 15:21:32 by simonm] off-by-one in
 folding of tagToEnum#.

---
 ghc/compiler/simplCore/ConFold.lhs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ghc/compiler/simplCore/ConFold.lhs b/ghc/compiler/simplCore/ConFold.lhs
index 1dfaf8242ac2..e6f4be7fbbd1 100644
--- a/ghc/compiler/simplCore/ConFold.lhs
+++ b/ghc/compiler/simplCore/ConFold.lhs
@@ -104,7 +104,7 @@ tryPrimOp TagToEnumOp [Type ty, Con (Literal (MachInt i _)) _]
   | otherwise = panic "tryPrimOp: tagToEnum# on non-enumeration type"
     where tag = fromInteger i
 	  constrs = tyConDataCons tycon
-	  (dc:_) = [ dc | dc <- constrs, tag == dataConTag dc ]
+	  (dc:_) = [ dc | dc <- constrs, tag == dataConTag dc - fIRST_TAG ]
 	  (Just (tycon,_)) = splitTyConApp_maybe ty
 \end{code}
 
-- 
GitLab