#6067: regression: cgrun051(ghci) failing in HEAD
---------------------------------+------------------------------------------
    Reporter:  simonmar          |       Owner:                  
        Type:  bug               |      Status:  new             
    Priority:  highest           |   Milestone:  7.6.1           
   Component:  Compiler          |     Version:  7.5             
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by simonpj):

 I can see what is happening.  We have
 {{{
    case error "OK" of { x::T1 -> blah }
 }}}
 where `T1` is a data type with no constructors.

  * With some level of optimisation GHC sees that `error` returns bottom,
 and simplifies to `error "OK"`.
  * But in GHCi, GHC doesn't see the bottom, but instead sees that the case
 is scrutinising a data type with no constructors, so it replaces the whole
 case with `error "Impossible case alternative"`.

 The latter transformation is really wrong, even with our liberal exception
 semantics.  Really it should only be done if the scrutinee is guaranteed
 not to raise an exception.

 This links to a converstaion I had with Max.  The idea is:
  * In Core, allow an empty list of alternatives in `case`.
  * If the scrutinee provably is bottom, discard all the alternatives
 (since they are unreachable)

 Things to bear in mind:
  * This avoid the need to add "unsafe" coercions.
  * Case expressions would need to carry their type (as they do at present)
  * The code generator should treat `(case e of [])` just like `e`.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6067#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to