[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 09:49:19 UTC 2018
#15696: Derived Ord instance for enumerations with more than 8 elements seems to be
incorrect
-------------------------------------+-------------------------------------
Reporter: mrkkrp | Owner: (none)
Type: bug | Status: new
Priority: highest | Milestone: 8.6.1
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):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by osa1):
* cc: osa1 (added)
Comment:
The problem is in this Core generated for this program:
{{{
-- RHS size: {terms: 5, types: 2, coercions: 0, joins: 0/0}
f_r6li
f_r6li = \ ds_d3M6 -> case ds_d3M6 of { () -> T2 }
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
lvl_r6lj
lvl_r6lj = f_r6li ()
main2
main2
= case dataToTag# lvl_r6lj of a#_a2rY { __DEFAULT ->
case dataToTag# lvl_r6lj of b#_a2rZ { __DEFAULT ->
...
}}}
We get the tag of a CAF (`lvl_r6lj`) before evaluating it, so we get tag
of a thunk. The need for evaluating argument of `dataToTag#` is explained
in `Note [dataToTag#]` in primops.txt.pp. It seems like we're inlining
`getTag`, and then somehow eliminating the case expression in `getTag` (to
evaluate its argument). If I change the `INLINE` annotation of `getTag` to
`NOINLINE` this works as expected.
I don't know why we're elminating the `case` in `getTag` after inlining it
yet.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15696#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list