
#16310: Program fails with "Impossible case alternative" when optimized -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Resolution: wontfix | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => wontfix Comment: After some thought, I've come to the conclusion that this isn't a bug. Here is what is happening. GHC scrutinizes a `$WRefl` of type `T1Sym :~: T2Sym`. GHC, in its infinite wisdom, recognizes that `T1Sym` and `T2Sym` are distinct data types, and therefore cannot possibly be equal. Therefore, `SimplUtils.mkCase` transforms this into `case ($WRefl :: T1Sym :~: T2Sym) of {}`, since the `Refl` case is "unreachable". However, due to our crafty use of `unsafeCoerce`, we //do// actually enter this case, and disaster strikes. I've come to the conclusion that `axiom`, much like `unsafePerformIO`, requires careful use of `NOINLINE` in order to use in a safe fashion. The fact that `apply` must be marked as `NOINLINE` reflects this reality. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16310#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler