[GHC] #15696: Derived Ord instance for enumerations with more than 8 elements seems to be incorrect

GHC ghc-devs at haskell.org
Wed Oct 3 12:09:28 UTC 2018


#15696: Derived Ord instance for enumerations with more than 8 elements seems to be
incorrect
-------------------------------------+-------------------------------------
        Reporter:  mrkkrp            |                Owner:  (none)
            Type:  bug               |               Status:  patch
        Priority:  highest           |            Milestone:  8.6.2
       Component:  Compiler          |              Version:  8.6.1
      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):  Phab:D5196
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 I agree with comment:38.   Yes, the code generator is the right place to
 do it.

 Yes, we could ooptimise for `LFCon`, but the simplifier will have done
 that already.  The only case I think we could reliably optimise, that
 would not be done already, is
 {{{
 case x of y
    A       -> blah
    DEFAULT -> ...(dataToTag# y)...
 }}}
 In this case we really do know that `y` points to the value.  It would not
 be hard to let the code gen spot this; but I doubt it would happen much.

 > Right, agreed that looking at tag bits would work for small types.

 This should happen automatically if we use the code for `cgCase`.  It
 already has a fast-path for the case when the scrutinee is evaluated.

 But you point is perhaps that for small types we don't need to index the
 info table: the tag is in the bits.  Yes, that's a good idea.

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


More information about the ghc-tickets mailing list