Skip to content

the_gc_thread variable from GC.c is not aligned to 64

When compiling GHC with clang and -march=native flag, the compiler emits vmovaps instruction with unaligned operand for this code:

* thread #1, name = 'ghc-pkg', stop reason = signal SIGBUS: hardware error
    frame #0: 0x0000000804e476c6 libHSrts-ghc8.0.2.so`initGcThreads [inlined] new_gc_thread(n=0) at GC.c:818
   815          ws->todo_q = newWSDeque(128);
   816          ws->todo_overflow = NULL;
   817          ws->n_todo_overflow = 0;
-> 818          ws->todo_large_objects = NULL;
   819 
   820          ws->part_list = NULL;
   821          ws->n_part_blocks = 0;

Research done by another FreeBSD developer suggested that this is due

StgWord8 the_gc_thread[sizeof(gc_thread) + 64 * sizeof(gen_workspace)];

not being aligned to 64 bytes, because struct gc_thread have no alignment specifier.

Detailed information can be found in FreeBSD bugzilla: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226059

Trac metadata
Trac field Value
Version 8.4.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information