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

GHC ghc-devs at haskell.org
Wed Oct 3 10:21:17 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:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 OK. This is the STG I get:

 {{{
 Main.main_f [InlPrag=NOINLINE] :: Main.T
 [GblId, Caf=NoCafRefs, Unf=OtherCon []] =
     CCS_DONT_CARE Main.T2! [];

 Main.main_a [InlPrag=NOINLINE] :: Main.T
 [GblId, Unf=OtherCon []] =
     [] \u [] Main.main_f;

 Main.main1 :: GHC.Base.String
 [GblId] =
     [] \u []
         case dataToTag# [Main.main_a] of a'_s3tm {
           __DEFAULT ->
               case <# [a'_s3tm 1#] of {
                 __DEFAULT ->
                     case a'_s3tm of {
                       __DEFAULT -> GHC.Show.$fShowOrdering1;
                       1# -> GHC.Show.$fShowOrdering3;
                     };
                 1# -> GHC.Show.$fShowOrdering5;
               };
         };
 }}}

 Exactly the same problem, no evals around the CAF (`main_a`).

 Are you maybe confused because in the STG dump you also see the STG for
 `cmpT`? It's actually inlined in `main` so the top-level for `cmpT` is not
 used.

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


More information about the ghc-tickets mailing list