Weird Activation Records (RTS wizards, please help!)

Wolfgang Thaller
Wed, 6 Mar 2002 17:15:50 +0100

I can't seem to get the Garbage Collector to work properly on MacOS X.
When a program triggers the Garbage Collector, it aborts with the 
following message:
a.out: fatal error: scavenge_stack: weird activation record found on stack: 0

The same error happens both in unregistered mode and using my 
half-finished powerpc mangler (BTW, Hello World already works in 
registered mode!). In unregistered mode, I have also observed 
different numbers instead of zero in the error message.

I'm positive that the problem is in the basic day-to-day workings of 
the STG machine.
main = print $ length $ [1..5000000]  -- aborts the first time GC is invoked
It has nothing to do with the libs, I can replace length and the list 
generation with my own functions and print with a foreign import, and 
the result stays the same: crash on first GC, fine otherwise.

Now I'm stuck. Are there any reasonably up-to-date docs on what a 
"normal" activation record should look like? The file GC.c is not 
exactly the kind of code that I understand the first time that I read 

One of my random guesses is that there is a problem with struct 
alignment, which has more padding on PPC than on Intel --- on the 
other hand, GHC is supposed to work on Sparc, and that doesn't use 
Intel alignment either, AFAIK  (does the HEAD currently work on 
Sparc? The ghc-5.03 snapshot on the download page seems to have only 
intel versions).

Can anyone give me any hints?