Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,830
    • Issues 4,830
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 447
    • Merge requests 447
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13260

Closed
Open
Created Feb 10, 2017 by rwbarton@trac-rwbarton

panic on unboxed string literal in pattern

I don't think this program is meaningful, but it shouldn't cause a panic.

{-# 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.

Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking