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

GHC ghc-devs at haskell.org
Wed Oct 10 19:16:44 UTC 2018


#15696: Derived Ord instance for enumerations with more than 8 elements seems to be
incorrect
-------------------------------------+-------------------------------------
        Reporter:  mrkkrp            |                Owner:  osa1
            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:  #14677, #15155    |  Differential Rev(s):  Phab:D5196,
       Wiki Page:                    |  Phab:D5201
-------------------------------------+-------------------------------------

Comment (by osa1):

 Simon, you said that we can remove `can_fail=True` for `dataToTag#` after
 removing various hacks (in comment:60), and I also used to think that this
 should be the case, but thinking about this more I think `dataToTag#`
 should
 stay as `can_fail=True`.

 The reason is because `dataToTag#` evaluates the argument and returns an
 unboxed
 value, so I think these two expressions calls should have the same value:

 {{{
 exprOkForSpeculation `dataToTag# foo`
 exprOkForSpeculation `case foo of x -> 1#` -- note: foo is lifted
 }}}

 Looking at the code I see that the latter returns `False` (because the
 scrutinee is lifted), so for the former to return false we need to mark
 `dataToTag#` as
 `can_fail = True`. Does this make sense?

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


More information about the ghc-tickets mailing list