[GHC] #14768: -O1 changes result at runtime, duplicating __DEFAULT case

GHC ghc-devs at haskell.org
Wed Feb 7 09:56:00 UTC 2018


#14768: -O1 changes result at runtime, duplicating __DEFAULT case
-------------------------------------+-------------------------------------
        Reporter:  Bodigrim          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.4.1-alpha3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

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

 In [changeset:"4aa98f4a3cb0c965c4df19af2f1ccc2c5483c3a5/ghc"
 4aa98f4a/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="4aa98f4a3cb0c965c4df19af2f1ccc2c5483c3a5"
 Fix utterly bogus TagToEnum rule in caseRules

 In prelRules we had:

   tx_con_tte :: DynFlags -> AltCon -> AltCon
   tx_con_tte _      DEFAULT      = DEFAULT
   tx_con_tte dflags (DataAlt dc)
     | tag == 0  = DEFAULT   -- See Note [caseRules for tagToEnum]
     | otherwise = LitAlt (mkMachInt dflags (toInteger tag))

 The tag==0 case is totally wrong, and led directly to Trac #14768.

 See "Beware" in Note [caseRules for tagToEnum] (in the patch).

 Easily fixed, though!
 }}}

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


More information about the ghc-tickets mailing list