#13994 closed bug (fixed)

STG lint failure on master

Reported by: bgamari Owned by:
Priority: highest Milestone: 8.4.1
Component: Compiler Version: 8.3
Keywords: stg-lint Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #14787 Differential Rev(s): Phab:D4404
Wiki Page:

Description

As of 4700baaf8f9bf3c44a53a595d840c7c14cfd6f98 building with this build.mk results in an STG lint failure,

BuildFlavour = devel2
include mk/flavours/$(BuildFlavour).mk

GhcLibHcOpts += -g3 -ddump-to-file -ddump-stg -dcore-lint -dstg-lint -dcmm-lint
GhcRtsHcOpts += -g3
GhcStage2HcOpts += -g3 -ddump-to-file -ddump-stg -dcore-lint -dstg-lint -dcmm-lint

The failures occurs while building libraries/integer-gmp/dist-install/build/GHC/Integer/Type.o and are of the form,

          *** Stg Lint ErrMsgs: in Stg2Stg ***
  <no location info>: warning:
       [in body of lambda with binders m0_scBi :: State# s_a2Ej
                                                  -> State# s_a2Ej,
                                       s1_scBj :: State# s_a2Ej]
      s'_scBk is out of scope
  <no location info>: warning:
       [RHS of $j1_sdij :: (# BigNat, GmpLimb# #)]
      Let(rec) binder ‘$j1_sdij’ has unlifted type ‘(# BigNat,
                                                       GmpLimb# #)’
      RHS: (elided for brevity)

 <no location info>: warning:
       [RHS of $j4_sdQ1 :: (# BigNat, BigNat #)]
      Let(rec) binder ‘$j4_sdQ1’ has unlifted type ‘(# BigNat, BigNat #)’
      RHS: (elided)

Change History (7)

comment:1 Changed 13 months ago by bgamari

Keywords: stg-lint added

comment:2 Changed 11 months ago by bgamari

Priority: highhighest

We should verify that this is fixed before the release.

comment:3 Changed 10 months ago by osa1

I get a different error when I use your build.mk with latest master branch:

"inplace/bin/ghc-stage1" -hisuf hi -osuf  o -hcsuf hc -static  -O -H64m -Wall   -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header   -this-unit-id ghc-8.5 -hide-all-packages -i -icompiler/backpack -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils -icompiler/vectorise -icompiler/stage2/build -Icompiler/stage2/build -icompiler/stage2/build/./autogen -Icompiler/stage2/build/./autogen -Icompiler/. -Icompiler/parser -Icompiler/utils -Icompiler/../rts/dist/build -Icompiler/stage2   -optP-DGHCI -optP-include -optPcompiler/stage2/build/./autogen/cabal_macros.h -package-id array-0.5.2.0 -package-id base-4.11.0.0 -package-id binary-0.8.5.1 -package-id bytestring-0.10.8.2 -package-id containers-0.5.11.0 -package-id deepseq-1.4.3.0 -package-id directory-1.3.1.5 -package-id filepath-1.4.1.2 -package-id ghc-boot-8.5 -package-id ghc-boot-th-8.5 -package-id ghci-8.5 -package-id hpc-0.6.0.3 -package-id process-1.6.2.0 -package-id template-haskell-2.13.0.0 -package-id terminfo-0.4.1.1 -package-id time-1.8.0.2 -package-id transformers-0.5.5.0 -package-id unix-2.7.2.2 -Wall -Wno-name-shadowing -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -Wnoncanonical-monoid-instances -this-unit-id ghc -XHaskell2010 -XNoImplicitPrelude -optc-DTHREADED_RTS -DGHCI_TABLES_NEXT_TO_CODE -DSTAGE=2 -Rghc-timing -O0 -DDEBUG -g3 -ddump-to-file -ddump-stg -dcore-lint -dstg-lint -dcmm-lint -Wcpp-undef -no-user-package-db -rtsopts       -Wnoncanonical-monad-instances  -odir compiler/stage2/build -hidir compiler/stage2/build -stubdir compiler/stage2/build   -dynamic-too -c compiler/utils/FastString.hs -o compiler/stage2/build/FastString.o -dyno compiler/stage2/build/FastString.dyn_o
ghc-stage1: panic! (the 'impossible' happened)
  (GHC version 8.5.20180206 for x86_64-unknown-linux):
        kindPrimRep
  RuntimeRep
  typePrimRep ('IntRep :: RuntimeRep)
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
        pprPanic, called at compiler/simplStg/RepType.hs:346:5 in ghc:RepType

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Interestingly if I remove -dstg-lint parameter it compiles fine. So it seems like there still is a problem with StgLint, but maybe a different one than the original error.

comment:4 Changed 10 months ago by osa1

Differential Rev(s): Phab:D4396

StgLint is still broken in other ways but I fixed the problem mentioned in comment:3 in Phab:D4396.

comment:5 Changed 10 months ago by osa1

After Phab:D4396 it's failing in GHC.Integer.Type. This time the problem is we have in scrutinee position an unboxed tuple (pair) with State# as second argument, but binder becomes Unit# after unarise becuase State# has no representation in runtime. Error message:

ghc-stage1: panic! (the 'impossible' happened)
  (GHC version 8.5.20180207 for x86_64-unknown-linux):
        ASSERT failed!
  dataConInstArgTys Unit#
  [k0_10, a_11]
  ['TupleRep '[], 'LiftedRep, State# s_a2Hq, a_a2Hr]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
        pprPanic, called at compiler/utils/Outputable.hs:1206:5 in ghc:Outputable
        assertPprPanic, called at compiler/basicTypes/DataCon.hs:1255:76 in ghc:DataCon

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

I look into this in more detail later.

comment:6 Changed 10 months ago by osa1

Differential Rev(s): Phab:D4396Phab:D4404

comment:7 Changed 10 months ago by bgamari

Resolution: fixed
Status: newclosed

This was resolved via #14787.

Note: See TracTickets for help on using tickets.