
#13317: exprIsConApp_maybe should deal better with strings -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.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: -------------------------------------+------------------------------------- Consider {{{ x :: Addr# x = "foo"# y = case unpackCString# x of [] -> ... (x:xs) -> ... }}} `exprIsConApp_maybe` has a special case for literal strings; see `Note [exprIsConApp_maybe on literal strings]` in `CoreSubst`. But it only works if `unpackCString#` is applied to a literal, not to a variable bound to a literal (like `x`). The fix is easy. Instead of this code {{{ , [Lit (MachStr str)] <- args = dealWithStringLiteral fun str co }}} we want to use `exprIsLiteral_maybe`, thus {{{ , Just (MachStr str) <- exprIsLiteral_maybe ... arg = dealWithStringLiteral fun str co }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13317 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler