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

GHC ghc-devs at haskell.org
Tue Nov 7 23:26:55 UTC 2017


#13990: Core Lint error on empty case
-------------------------------------+-------------------------------------
        Reporter:  mbieleck          |                Owner:  (none)
            Type:  bug               |               Status:  patch
        Priority:  highest           |            Milestone:  8.2.3
       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):  Phab:D4160
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 Simon asked me to note here that his remark in comment:9 about
 `checkCaseAlts` was a bit off. The `null alts` there is doing something a
 bit different: allowing case matches with no alternatives on "nearly-
 infinite" types like `Int#`. Pulling that test out actually makes the
 build fail. Why? That's not actually entirely clear to me. Somewhere in
 `Text` internals, we get a Core Lint error

 {{{
 5258    <no location info>: warning:
 5259        In a case alternative: (I# n#_a4mN :: Int#)
 5260        Case expression with non-exhaustive alternatives
 5261            case lvl_sfty n#_a4mN of wild_00 { }
 }}}

 This is slightly surprising, because the relevant `lvl_sfty` seems to be

 {{{
 29713   lvl_sfty :: Int# -> Int#
 29714   [LclId,
 29715    Arity=1,
 29716    Str=<L,U>x,
 29717    Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
 29718            WorkFree=True, Expandable=True, Guidance=NEVER}]
 29719   lvl_sfty
 29720     = \ (n#_a4mW :: Int#) ->
 29721         error
 29722           @ 'IntRep
 29723           @ Int#
 29724           ($dIP_saA9
 29725            `cast` (Sym (N:IP[0] <"callStack">_N <CallStack>_N)
 29726                    :: (CallStack :: *) ~R# (?callStack::CallStack ::
 Constraint)))
 29727           (augment
 29728              @ Char
 29729              lvl_sftt
 29730              (augment
 29731                 @ Char
 29732                 lvl_sftv
 29733                 (augment
 29734                    @ Char
 29735                    lvl_sftx
 29736                    (showSignedInt $fShow(,)1 (I# n#_a4mW) ([] @
 Char)))))
 }}}

 which is just a call to `error`.

 One other question: the `exprIsHNF` error was clearly hosed, and badly so.
 But should we leave the `scrut_diverges` warning in place? That seems like
 it's useful, even if it's not reliable. If we decide to leave that in
 place, can/should we apply it to `Int#` and such as well?

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


More information about the ghc-tickets mailing list