Quantcast

[GHC] #6067: regression: cgrun051(ghci) failing in HEAD

classic Classic list List threaded Threaded
5 messages Options
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[GHC] #6067: regression: cgrun051(ghci) failing in HEAD

GHC
#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:                    |  
---------------------------------+------------------------------------------
 {{{
 =====> cgrun051(ghci) 46 of 79 [0, 0, 0]
 cd . && '/64playpen/simonmar/nightly/HEAD-cam-04-unx/x86_64-unknown-
 linux/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -dno-
 debug-output -no-user-package-conf -rtsopts  -fno-ghci-history cgrun051.hs
 --interactive -v0 -ignore-dot-ghci +RTS -I0.1 -RTS   <cgrun051.genscript
 1>cgrun051.interp.stdout 2>cgrun051.interp.stderr
 Actual stderr output differs from expected:
 --- ./cgrun051.stderr   2012-04-30 18:02:44.638862376 +0100
 +++ ./cgrun051.run.stderr       2012-05-01 11:19:15.808880452 +0100
 @@ -1 +1 @@
 -cgrun051: OK
 +cgrun051: Impossible case alternative
 *** unexpected failure for cgrun051(ghci)
 }}}

 The code is very simple.  For some reason the simplifier is replacing the
 `error "OK"` with `runtimeError "Impossible case alternative"`, but only
 in GHCi.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #6067: regression: cgrun051(ghci) failing in HEAD

GHC
#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
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #6067: regression: cgrun051(ghci) failing in HEAD

GHC
In reply to this post by GHC
#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@…):

 commit ac230c5ef652e27f61d954281ae6a3195e1f9970
 {{{
 Author: Simon Peyton Jones <[hidden email]>
 Date:   Wed May 2 15:44:14 2012 +0100

     Allow cases with empty alterantives

     This patch allows, for the first time, case expressions with an empty
     list of alternatives. Max suggested the idea, and Trac #6067 showed
     that it is really quite important.

     So I've implemented the idea, fixing #6067. Main changes

      * See Note [Empty case alternatives] in CoreSyn

      * Various foldr1's become foldrs

      * IfaceCase does not record the type of the alternatives.
        I added IfaceECase for empty-alternative cases.

      * Core Lint does not complain about empty cases

      * MkCore.castBottomExpr constructs an empty-alternative case
        expression   (case e of ty {})

      * CoreToStg converts '(case e of {})' to just 'e'

  compiler/coreSyn/CoreArity.lhs     |   10 +++-
  compiler/coreSyn/CoreFVs.lhs       |    2 +-
  compiler/coreSyn/CoreLint.lhs      |    8 ---
  compiler/coreSyn/CoreSyn.lhs       |   53 ++++++++++++++++++++-
  compiler/coreSyn/CoreUnfold.lhs    |    4 +-
  compiler/coreSyn/MkCore.lhs        |   12 ++++-
  compiler/iface/BinIface.hs         |    7 +++
  compiler/iface/IfaceSyn.lhs        |   14 +++++-
  compiler/iface/MkIface.lhs         |    4 +-
  compiler/iface/TcIface.lhs         |    6 ++
  compiler/simplCore/OccurAnal.lhs   |    2 +-
  compiler/simplCore/SimplCore.lhs   |   10 ++--
  compiler/simplCore/SimplUtils.lhs  |   56 +++++++++++-----------
  compiler/simplCore/Simplify.lhs    |   93
 ++++++++++++++++++------------------
  compiler/specialise/SpecConstr.lhs |    4 +-
  compiler/specialise/Specialise.lhs |    8 ++--
  compiler/stgSyn/CoreToStg.lhs      |   12 +++++
  compiler/stranal/DmdAnal.lhs       |    2 +-
  18 files changed, 201 insertions(+), 106 deletions(-)
 }}}

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #6067: regression: cgrun051(ghci) failing in HEAD

GHC
In reply to this post by GHC
#6067: regression: cgrun051(ghci) failing in HEAD
-------------------------------+--------------------------------------------
  Reporter:  simonmar          |          Owner:                  
      Type:  bug               |         Status:  closed          
  Priority:  highest           |      Milestone:  7.6.1          
 Component:  Compiler          |        Version:  7.5            
Resolution:  fixed             |       Keywords:                  
        Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown      |     Difficulty:  Unknown        
  Testcase:                    |      Blockedby:                  
  Blocking:                    |        Related:                  
-------------------------------+--------------------------------------------
Changes (by simonpj):

  * status:  new => closed
  * resolution:  => fixed


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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #6067: regression: cgrun051(ghci) failing in HEAD

GHC
In reply to this post by GHC
#6067: regression: cgrun051(ghci) failing in HEAD
-------------------------------+--------------------------------------------
  Reporter:  simonmar          |          Owner:                  
      Type:  bug               |         Status:  closed          
  Priority:  highest           |      Milestone:  7.6.1          
 Component:  Compiler          |        Version:  7.5            
Resolution:  fixed             |       Keywords:                  
        Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown      |     Difficulty:  Unknown        
  Testcase:                    |      Blockedby:                  
  Blocking:                    |        Related:                  
-------------------------------+--------------------------------------------

Comment(by pumpkin):

 Replying to [comment:3 simonpj]:

 Does this fix #2431?

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

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