STG scope error
StgRhsClosure can contain duplicated names in its free variable and argument list.
Example bug: libraries/integer-gmp/src/GHC/Integer/Type.hs
GHC HEAD and 8.2.2 has this issue.
I have not checked with other versions.
I've extended the STG linter to do scope checking. See the patch attached.
- patch GHC head:
git apply StgScopeCheck.patch
- make sure every compiled stg is linted: add the following to
GhcStage2HcOpts += -dstg-lint GhcLibHcOpts += -dstg-lint GhcRtsHcOpts += -dstg-lint
- compile GHC HEAD
Background info: I've found this issue because I'm using GHC as a Haskell fronted for my whole program compiler project. I work on The GRIN Compiler (https://github.com/grin-tech) where GHC/GRIN compiles STG to GRIN.