
#15867: STG scope error -------------------------------------+------------------------------------- Reporter: csabahruska | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.7 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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. To reproduce: * patch GHC head: `git apply StgScopeCheck.patch` * make sure every compiled stg is linted: add `-dstg-lint` to GhcStage2HcOpts GhcLibHcOpts GhcRtsHcOpts config vars * 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15867 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler