
#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 osa1): Right, fixing this in Cmm is also what I suggested in comment:24. I think two key questions are: - Can we optimise this? That is, can we know for certain that the argument of a `dataToTag#` points directly to a value (without going through blackholes or other indirections like IND_STATIC)? - Is this worth optimising? Unless the answer to both of those is yes, then I think it makes sense to do this in Cmm (when compiling the primop). Then we can remove a bunch of notes about `getTag` and hacks in CorePrep, and simplify `getTag` to `getTag = dataToTag#`. I think we can also update the primop as `can_fail = False`. It seems to me that Core is not the right place to answer (1). Even in STG I don't know if we can answer that question with certainty. I think it's doable in Cmm where we know about "lambda form" of ids (`LambdaFormInfo`) which tells us about how to enter an object. If "lambda form" of an argument is `LFCon` then we optimise, otherwise we enter. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15696#comment:38 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler