summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2018-08-06 14:52:59 -0400
committerBen Gamari <ben@smart-cactus.org>2018-08-06 17:53:14 -0400
commitc6cc93bca69abc258513af8cf2370b14e70fd8fb (patch)
tree5171c1b4271eae0166d1b94993eaea3602ee7114
parentff06176b87078ce56cc7b6b3405a029ef3d0046f (diff)
downloadhaskell-c6cc93bca69abc258513af8cf2370b14e70fd8fb.tar.gz
rts: Ensure that the_gc_thread is aligned
Since we cast this to a gc_thread the compiler may assume that it's aligned. Make sure that this is so. Fixes #15482.
-rw-r--r--rts/sm/GC.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 742ae360c5..9b3151641e 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -128,7 +128,11 @@ uint32_t mutlist_MUTVARS,
gc_thread **gc_threads = NULL;
#if !defined(THREADED_RTS)
-StgWord8 the_gc_thread[sizeof(gc_thread) + 64 * sizeof(gen_workspace)];
+/* Use conservative alignment since we will cast this to a gc_thread and
+ * consequently the compiler may assume it is aligned. See #15482.
+ */
+StgWord8 the_gc_thread[sizeof(gc_thread) + 64 * sizeof(gen_workspace)]
+ __attribute__((aligned(sizeof(W_))));
#endif
// Number of threads running in *this* GC. Affects how many