GC segfault with devel2 compiler on T16525a
$ cd testsuite/tests/ghci/T16525a/
$ ghc --interactive < T16525a.script
GHCi, version 9.3.20211109: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/zubin/dotfiles/.ghci
λ> λ> Ok, two modules loaded.
λ> λ> λ> Ok, no modules loaded.
λ> it :: ()
λ> ["a;lskdfa;lszkfsd;alkfjas"]
it :: ()
λ> it :: ()
λ> it :: ()
λ> zsh: segmentation fault (core dumped) $(cur_ghc) --interactive < T16525a.script
backtrace:
Core was generated by `/home/zubin/ghc/_build_devel2/stage1/bin/ghc --interactive'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 evacuate (p=0x40ea1018) at rts/sm/Evac.c:686
686 q = RELAXED_LOAD(p);
[Current thread is 1 (Thread 0x7fe5ea3c3100 (LWP 447135))]
(gdb) bt
#0 evacuate (p=0x40ea1018) at rts/sm/Evac.c:686
#1 0x0000000003cd9762 in mark_root (user=<optimized out>, root=<optimized out>) at rts/sm/GC.c:1883
#2 0x0000000003ce49e0 in markCAFs (evac=evac@entry=0x3cd9750 <mark_root>, user=0x47454e0) at rts/sm/GCAux.c:162
#3 0x0000000003cdaf4b in GarbageCollect (collect_gen=<optimized out>, collect_gen@entry=0, do_heap_census=do_heap_census@entry=false,
is_overflow_gc=is_overflow_gc@entry=true, deadlock_detect=deadlock_detect@entry=false, gc_type=gc_type@entry=2, cap=cap@entry=0x47454e0,
idle_cap=<optimized out>) at rts/sm/GC.c:508
#4 0x0000000003cc46dd in scheduleDoGC (pcap=pcap@entry=0x7fff7efc7098, task=task@entry=0x4756e80, force_major=force_major@entry=false,
is_overflow_gc=<optimized out>, deadlock_detect=deadlock_detect@entry=false) at rts/Schedule.c:1884
#5 0x0000000003cc5375 in schedule (initialCapability=initialCapability@entry=0x4601e00 <MainCapability>, task=task@entry=0x4756e80)
at rts/Schedule.c:579
#6 0x0000000003cc6c9e in scheduleWaitThread (tso=0x4200406ce8, ret=ret@entry=0x0, pcap=pcap@entry=0x7fff7efc7130) at rts/Schedule.c:2652
#7 0x0000000003cbc5e6 in rts_evalLazyIO (cap=cap@entry=0x7fff7efc7130, p=p@entry=0x3d12fa8, ret=ret@entry=0x0) at rts/RtsAPI.c:566
#8 0x0000000003cbf06f in hs_main (argc=<optimized out>, argv=<optimized out>, main_closure=0x3d12fa8, rts_config=...) at rts/RtsMain.c:72
#9 0x00000000004a56e2 in main ()
(gdb) p p
$1 = (StgClosure **) 0x40ea1018
(gdb) p *p
Cannot access memory at address 0x40ea1018
Seems to be a race condition since setting breakpoints in markCAFs
or mark_root
will result in successful execution.