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

GHC ghc-devs at haskell.org
Tue Oct 2 22:05:00 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 dfeuer):

 Aha! Actually, I believe even one fall-back should be able to use tag
 bits, as long as they're greater than 1. So:

 === When the type is recognized as having a small number of constructors

 Check the tag bits.
 If they '''are 0''', enter the closure.
 Otherwise, subtract 1 to get the tag.

 === When the type is unknown

 Check the tag bits.
 If they '''are less than or equal to 1''', enter the closure.
 Otherwise, subtract 1 to get the tag.

 === When the type has too many constructors

 Enter the closure.

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


More information about the ghc-tickets mailing list