Skip to content

ghc-9.15.20250912: typing plugins plus `-fpolymorphic-specialisation` cause SIGSEGV when the program is run

Summary

This may be related to #23109, since the code snapshot is from a similar date, so I've added it to the list in that ticket. I haven't tried most of the other repros from the list yet with current HEAD, but current master of horde-ad compiles and runs fine at least (which also means this is not blocking me personally in any way).

This test crashes at runtime. Running under gdb shows it's a SIGSEGV:

gdb dist-newstyle/build/x86_64-linux/ghc-9.15.20250912/horde-ad-0.1.0.0/t/simplifiedOnlyTest/build/simplifiedOnlyTest/simplifiedOnlyTest
...
Thread 5 "ghc_worker" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe7fff6c0 (LWP 442542)]
0x0000000001bb6ff8 in stg_ap_0_fast ()
(gdb) bt
#0  0x0000000001bb6ff8 in stg_ap_0_fast ()
#1  0x0000000000000000 in ?? ()

Removing --ghc-options="-fpolymorphic-specialisation" from the repro makes the test pass.

It's possible the cause is unsafe operations in my code that happen to show their unsoundness only when more specialization happens, but I think it's not very likely.

I've minimized the code minimally so far, but I'm ready to assist in any way. Linting (-dcore-lint -dstg-lint -dcmm-lint -dtag-inference-checks) doesn't error out.

Steps to reproduce

git clone git@github.com:Mikolaj/horde-ad.git
cd horde-ad
git checkout VTA-fail
rm -f cabal.project.local
rm -rf ~/.cabal/packages/head.hackage.ghc.haskell.org 
cabal update
cabal test -w /home/mikolaj/r/ghc.13092025/ghc/_build/stage1/bin/ghc --allow-newer --enable-optimization --ghc-options="-fpolymorphic-specialisation"

Expected behavior

Test passes with --ghc-options="-fpolymorphic-specialisation".

Environment

  • GHC version used: ghc-9.15.20250912

Optional:

  • Operating System: Ubuntu
  • System Architecture: AMD64
Edited by Mikolaj Konarski
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information