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

GHC ghc-devs at haskell.org
Thu Oct 4 15:05:36 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:                    |  Phab:D5201
-------------------------------------+-------------------------------------

Comment (by simonpj):

 > In compile time we sometimes know that a value is already evaluated, but
 we don't know specifics

 This ticket has convinced me that the property that "y is a correctly
 tagged pointer directly to an evaluated value" is ''extremely delicate''.
 The only time we are really sure of this is in the case-binder of a case
 expression:
 {{{
 case e of y <alts>
 }}}
 In `<alts>` we know that `y` really is a tagged pointer and points to the
 value.  I used to think that this was also true of the strict fields of a
 data constructor, but not so! See comment:36.

 Moreover, as comment:36 shows, the Simplifier (for good reasons) does not
 guaranteed to maintain the Delicate Property, even it if it holds at some
 point.  Only the code generator knows for sure.  Lets ''not'' attempt to
 do this in Core.

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


More information about the ghc-tickets mailing list