[GHC] #14118: Strangeness regarding STG alternative types and linter

GHC ghc-devs at haskell.org
Tue Aug 15 17:21:37 UTC 2017


#14118: Strangeness regarding STG alternative types and linter
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 The `MultiValAlt` here arises from `CoreToStg.mkStgAltType`, which looks
 at the `typePrimRep` of the case binder to determine the `AltType`,
 {{{#!hs
   = case typePrimRep bndr_ty of
       [LiftedRep] -> case tyConAppTyCon_maybe (unwrapType bndr_ty) of
         Just tc
           | isAbstractTyCon tc -> look_for_better_tycon
           | isAlgTyCon tc      -> AlgAlt tc
           | otherwise          -> ASSERT2( _is_poly_alt_tycon tc, ppr tc )
                                   PolyAlt
         Nothing                -> PolyAlt
       [unlifted] -> PrimAlt unlifted
       not_unary  -> MultiValAlt (length not_unary)
 }}}

 Here we are hitting the `not_unary` case where `length not_unary == 0`
 since the binder is of type `State# s`, which is void.

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


More information about the ghc-tickets mailing list