[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 16:17:34 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.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):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
Omer, might you look at this. With `-ddump-stg` I see
{{{
Main.cmpT :: forall a1 a2. a1 -> a2 -> GHC.Types.Ordering
[GblId, Arity=2, Caf=NoCafRefs, Str=<S,U><S,U>, Unf=OtherCon []] =
[] \r [a2_s3tf b_s3tg]
case
case a2_s3tf of sat_s3th [Occ=Once] {
__DEFAULT -> dataToTag# [sat_s3th];
}
of
a'_s3ti
{ __DEFAULT ->
case
case b_s3tg of sat_s3tj [Occ=Once] {
__DEFAULT -> dataToTag# [sat_s3tj];
}
of
b'_s3tk
{ __DEFAULT ->
case <# [a'_s3ti b'_s3tk] of {
__DEFAULT ->
case ==# [a'_s3ti b'_s3tk] of {
__DEFAULT -> GHC.Types.GT [];
1# -> GHC.Types.EQ [];
};
1# -> GHC.Types.LT [];
};
};
};
}}}
which looks right. In another variant (I made `dataToTag#` lazy) I saw
{{{
Main.cmpT :: forall a1 a2. a1 -> a2 -> GHC.Types.Ordering
[GblId,
Arity=2,
Caf=NoCafRefs,
Str=<S,1*U><S,1*U>,
Unf=OtherCon []] =
[] \r [a2_s3tf b_s3tg]
case a2_s3tf of x1_s3th [Occ=Once] {
__DEFAULT ->
case dataToTag# [x1_s3th] of a'_s3ti {
__DEFAULT ->
case b_s3tg of x2_s3tj [Occ=Once] {
__DEFAULT ->
case dataToTag# [x2_s3tj] of b'_s3tk {
__DEFAULT ->
case <# [a'_s3ti b'_s3tk] of {
__DEFAULT ->
case ==# [a'_s3ti b'_s3tk] of {
__DEFAULT -> GHC.Types.GT [];
1# -> GHC.Types.EQ [];
};
1# -> GHC.Types.LT [];
};
};
};
};
};
}}}
But both stubbornly return `LT` instead of `EQ`. This must be a code-gen
or RTS issue. I have not looked at the Cmm. Might you do so?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15696#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list