Windows 7 i686 does not reliably align 16 byte aligned thread locals #138903
Labels
A-align
Area: alignment control (`repr(align(N))` and so on)
A-thread-locals
Area: Thread local storage (TLS)
C-bug
Category: This is a bug.
O-windows-7
OS: Windows 7 or Windows Server 2008 R2 or etc.
O-x86_32
Target: x86 processors, 32 bit (like i686-*) (IA-32)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The following program will reliably crash using the
i686-win7-windows-msvc
target on a Windows 7 installation using latest nightly.I tried this code:
This reliably produces the following panic.
My experience with/understanding of thread locals is mostly limited to what i've researched due to this issue, but it does appear that an i686 targeted executable on Windows 7 does not reliably align thread locals when 16 byte alignment is requested. I didn't see issues with even 8 byte alignment. I was not able to reproduce this issue on Windows 10.
Given that i686 win7 is a likely pretty niche target, do you think it would be reasonable to partially undo #123257 by disabling
has_thread_local
fori686-win7-windows-msvc
. It seems that i686 on Windows 7 can't be trusted for alignment of thread locals. I did test adjusting thei686-win7-windows-msvc
target in a local build of the compiler and it does appear to work for the test program.The 16 byte aligned thread local came from
matrixmultiply
which actually works around misalignment internally, but compiled this way I get the UB check panic anyway. I can certainly work around it by seeing ifmatrixmultiply
can be patched, or just doing that locally. But it seems like this should be fixed in the compiler ideally.The text was updated successfully, but these errors were encountered: