TH: panic in reportWarning when the message throws an exception
reportWarning
and reportError
doesn't force it's argument, so ghc
panics when printing the message.
To reproduce:
test :: Q [Dec]
test = do
reportWarning undefined
return []
Output:
main.hs:5:3: Warning:ghc: panic! (the 'impossible' happened)
(GHC version 7.8.1 for x86_64-unknown-linux):
Prelude.undefined
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
The fix could be:
--- a/compiler/typecheck/TcSplice.lhs
+++ b/compiler/typecheck/TcSplice.lhs
@@ -875,8 +875,8 @@ instance TH.Quasi (IOEnv (Env TcGblEnv TcLclEnv)) where
; let i = getKey u
; return (TH.mkNameU s i) }
- qReport True msg = addErr (text msg)
- qReport False msg = addWarn (text msg)
+ qReport True !msg = addErr (text msg)
+ qReport False !msg = addWarn (text msg)
qLocation = do { m <- getModule
; l <- getSrcSpanM
But possibly it should deepseq
the argument?
Trac metadata
Trac field | Value |
---|---|
Version | 7.8.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |