[GHC] #13260: panic on unboxed string literal in pattern
GHC
ghc-devs at haskell.org
Fri Feb 10 01:40:20 UTC 2017
#13260: panic on unboxed string literal in pattern
-------------------------------------+-------------------------------------
Reporter: rwbarton | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
I don't think this program is meaningful, but it shouldn't cause a panic.
{{{#!hs
{-# LANGUAGE MagicHash #-}
g y = case y of
"a"# -> True
_ -> False
}}}
{{{
[1 of 1] Compiling CaseOnString ( x/CaseOnString.hs, x/CaseOnString.o
)
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.1 for x86_64-unknown-linux):
litValue "a"#
}}}
The panic is also in at least 7.8, 7.10, and HEAD.
`"a"#` has type `Addr#`, and I suppose that if we allow `case` on `Addr#`
then it ought to use pointer equality. But the literal `"a"#` has no
particular address, so matching against it in a `case` doesn't make sense.
So I think we should just disallow unboxed string literals as patterns.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13260>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list