[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 10:02:54 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: |
-------------------------------------+-------------------------------------
Comment (by osa1):
Ah, so it turns out we have a special case in CorePrep (which runs after
simplifications) about `dataToTag#`, and we generate a case expression
around its argument after all the simplifications. It's explained in `Note
[dataToTag magic]` in CorePrep, and I can see in STG that it works as
expected:
{{{
lvl_r6ru = \u [] f_r6rt ();
lvl1_r6rv = CCS_DONT_CARE :! [lvl_r6ru []];
main2 =
\u []
case
case lvl_r6ru of sat_s6xD { __DEFAULT -> dataToTag#
[sat_s6xD]; }
of
a#_s6xE
{ __DEFAULT ->
case
case lvl_r6ru of sat_s6xF { __DEFAULT -> dataToTag#
[sat_s6xF]; }
of
...
}}}
So perhaps this is not because we get tag of a thunk. I don't know why not
inlining `getTag` fixes this.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15696#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list