[GHC] #15436: Compile-time panic, Prelude.!!: negative index

GHC ghc-devs at haskell.org
Wed Jul 25 16:21:24 UTC 2018


#15436: Compile-time panic, Prelude.!!: negative index
-------------------------------------+-------------------------------------
        Reporter:  pbrisbin          |                Owner:  (none)
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:
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:D5008
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"9897f6783a58265d5eaef5fb06f04320c7737e87/ghc"
 9897f678/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="9897f6783a58265d5eaef5fb06f04320c7737e87"
 Fix PrelRules.caseRules to account for out-of-range tags

 As Trac #15436 points out, it is possible to get
    case dataToTag# (x :: T) of
       DEFAULT -> blah1
       -1#     -> blah2
       0       -> blah3

 The (-1#) alterantive is unreachable, because dataToTag# returns
 tags in the range [0..n-1] where n is the number of data constructors
 in type T.

 This actually made GHC crash; now we simply discard the unreachable
 alterantive.  See Note [Unreachable caseRules alternatives]
 in PrelRules
 }}}

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


More information about the ghc-tickets mailing list