[GHC] #13990: Core Lint error on empty case

GHC ghc-devs at haskell.org
Wed Jul 19 20:17:29 UTC 2017


#13990: Core Lint error on empty case
-------------------------------------+-------------------------------------
        Reporter:  mbieleck          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.2.2
       Component:  Compiler          |              Version:  8.2.1-rc3
      Resolution:                    |             Keywords:  core-lint
                                     |  case
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nomeata):

 I believe the mistake is in `CoreLint` here. The question is: How can
 `CoreLint` know that `x_ap6` is both void and evaluated, hence cannot
 actually exist?

 Probably we just need to change the code
 {{{
      do { checkL (not (exprIsHNF scrut))
           (text "No alternatives for a case scrutinee in head-normal
 form:" <+> ppr scrut)
         ; checkWarnL scrut_diverges
           (text "No alternatives for a case scrutinee not known to diverge
 for sure:" <+> ppr scrut)
         }
 }}}
 to something that runs the first check only when `scrut_diverges` is false
 (if `scrut_diverges`, then it cannot be in normal form).

 Or find out why `exprIsHNF scrut` is `True` here.

 Or maybe the outer `case` of
 {{{
 case ds_dUn of { Foo x_ap6 -> case x_ap6 of { } }
 }}}
 should be empty, as the pattern `Foo x` is already absurd (due to the
 bang).

 Many options :-)

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


More information about the ghc-tickets mailing list