[commit: ghc] ghc-8.6: rts: Ensure that the_gc_thread is aligned (87a79e3)

git at git.haskell.org git at git.haskell.org
Tue Aug 7 12:30:25 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.6
Link       : http://ghc.haskell.org/trac/ghc/changeset/87a79e394013e5f722496900227b126015d0d780/ghc

>---------------------------------------------------------------

commit 87a79e394013e5f722496900227b126015d0d780
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Mon Aug 6 14:52:59 2018 -0400

    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.
    
    (cherry picked from commit c6cc93bca69abc258513af8cf2370b14e70fd8fb)


>---------------------------------------------------------------

87a79e394013e5f722496900227b126015d0d780
 rts/sm/GC.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 67eba93..bd4a81c 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



More information about the ghc-commits mailing list