non-exhaustive pattern in getSRTInfo
Here is the code I am attempting to execute:
res :: CoreBind
defaultCodeGen :: [StgBinding] -> IO [Cmm]
coreToStg mainPackageId [res] >>= defaultCodeGen >>= mapM_ (GHC.printDump . GHC.ppr)
defaultCodeGen makes a call to GHC's codeGen.
When I try to run coreToStg, I get the following error:
*** Exception: codeGen/CgUtils.hs:(993,2)-(1009,60): Non-exhaustive patterns in case
Looking at getSRTInfo and the SRT data type, it looks like the SRTEntries data constructor for SRT is never matched. From the comment in the SRT data type, it sounds like this entry is generated precisely by the coreToStg function.
getSRTInfo :: FCode C_SRT
getSRTInfo = do
srt_lbl <- getSRTLabel
srt <- getSRT
case srt of
-- TODO: Should we panic in this case?
-- Someone obviously thinks there should be an SRT
NoSRT -> return NoC_SRT
SRT off len bmp
| len > hALF_WORD_SIZE_IN_BITS || bmp == [fromIntegral srt_escape]
-> do id <- newUnique
let srt_desc_lbl = mkLargeSRTLabel id
emitRODataLits srt_desc_lbl
( cmmLabelOffW srt_lbl off
: mkWordCLit (fromIntegral len)
: map mkWordCLit bmp)
return (C_SRT srt_desc_lbl 0 srt_escape)
SRT off len bmp
| otherwise
-> return (C_SRT srt_lbl off (fromIntegral (head bmp)))
-- The fromIntegral converts to StgHalfWord
data SRT = NoSRT
| SRTEntries IdSet
-- generated by CoreToStg
| SRT !Int{-offset-} !Int{-length-} !Bitmap{-bitmap-}
-- generated by computeSRTs
If necessary I can package up some code that can be run to reproduce this bug, but perhaps there is a simpler answer first. Maybe I'm doing something in the wrong order in the code generation stuff.
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture | Unknown |