Skip to content

Segmentation fault running an application with --nonmoving-gc that has been compiled with -prof

Summary

Running an application with the non-moving GC that has been compiled with -prof seg faults.

GDB gives us this call stack:

0x00000000004c563c in resetStaticObjectForProfiling ()
(gdb) bt
#0  0x00000000004c563c in resetStaticObjectForProfiling ()
#1  0x00000000004ceaac in GarbageCollect ()
#2  0x00000000004bbf7c in scheduleDoGC.constprop.0.isra.0 ()
#3  0x00000000004bd414 in exitScheduler ()
#4  0x00000000004b9f1b in hs_exit_.part ()
#5  0x00000000004ba725 in shutdownHaskellAndExit ()
#6  0x00000000004b97a7 in hs_main ()
#7  0x000000000040a380 in main ()

Steps to reproduce

Suppose we have Main.hs be :

main = pure ()

And we then compile it with ghc Main.hs -rtsopts -prof Then let's try to run it like so:

ghc.nix ~ ./Main +RTS --nonmoving-gc
Segmentation fault

Expected behavior

Shouldn't seg fault

Environment

  • GHC version used: HEAD, 9.6.2, 9.4.5

  • Run from inside a ghc.nix environment

Edited by Teo Camarasu
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information