[project @ 1999-04-27 15:21:32 by simonm]
authorsimonm <unknown>
Tue, 27 Apr 1999 15:21:32 +0000 (15:21 +0000)
committersimonm <unknown>
Tue, 27 Apr 1999 15:21:32 +0000 (15:21 +0000)
off-by-one in folding of tagToEnum#.

ghc/compiler/simplCore/ConFold.lhs

index 1dfaf82..e6f4be7 100644 (file)
@@ -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}