[GHC] #15482: the_gc_thread variable from GC.c is not aligned to 64

GHC ghc-devs at haskell.org
Thu Aug 9 07:38:52 UTC 2018


#15482: the_gc_thread variable from GC.c is not aligned to 64
-------------------------------------+-------------------------------------
        Reporter:  arrowd            |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:  x86_64
                                     |  (amd64)
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by arrowd):

 Conrad Meyer, the FreeBSD guy that initially come with this suggestion
 also says that this fix is incorrect. Quoting him:



 Their change c6cc93bca only aligns the array to W_ aka StgWord aka
 StgWord64 aka unsigned long (8 bytes).

 This is insufficient for AVX2 alignment[1] (16 bytes for xmm, 32 for ymm)
 and still violates the guarantee attached to the gen_workspace structure
 (64 byte alignment).  They need to remove the 64-byte gen_workspace
 alignment or add 64-byte alignment to the array to remove their UB.  (They
 could align both to the smaller 32 bytes and still allow the compiler to
 take advantage of AVX2.)

 I don't know what lead them to believe an 8-byte alignment would fix an
 unaligned 32-byte AVX access.

 [1]: https://www.felixcloutier.com/x86/MOVAPS.html

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15482#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list