GHC panics on TH/QQ splice with external linkage present
Summary
GHC panics during module linking when TH/QQ is spliced. The module defining the TH/quoter must depend on another module of the same package, that has some external linkage.
Added: The behavior affects template haskell as well as QQ. See branch th
in the test repo
Steps to reproduce
Clone and build: https://gitlab.haskell.org/dminuoso/panic-testcase
Module Diagram
Mod (splices TH/QQ)
|
|
v
QQ (defines TH/QQ)
|
|
v
Ext (external linkage)
$ cabal v2-build
Build profile: -w ghc-8.10.2 -O1
In order, the following will be built (use -v for more details):
- panic-testcase-0.1.0.0 (lib) (first run)
Preprocessing library for panic-testcase-0.1.0.0..
Building library for panic-testcase-0.1.0.0..
compile: input file lib/Other.hs
[3 of 4] Compiling Other ( lib/Other.hs, /home/dminuoso/wobcom/projects/panic-testcase/dist-newstyle/build/x86_64-linux/ghc-8.10.2/panic-testcase-0.1.0.0/build/Other.o, /home/dminuoso/wobcom/projects/panic-testcase/dist-newstyle/build/x86_64-linux/ghc-8.10.2/panic-testcase-0.1.0.0/build/Other.dyn_o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.10.2:
Loading temp shared object failed: /run/user/1000/ghc29723_0/libghc_1.so: undefined symbol: crypt
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
Environment
- GHC version used:
- 8.10.2
- 8.10.1
- 8.8.4
- 8.6.5
Optional:
- Operating System: NixOS
- System Architecture: AMD64