Skip to content

Commit 4498375

Browse files
committed
Exclude alignment for MaskBuffer for i686-win7-windows-msvc
Windows 7 does not respect 16 byte alignment for thread locals on i686 builds. Rust 1.79 changed i686 windows builds to use native thread local support. As a result, using `matrixmultiply` on i686 win7 builds leads to a UB check panic nounwind when run on Windows 7. See <rust-lang/rust#138903> for more info. This change adds `i686-win7-windows-msvc` as an excluded target for the alignment attribute on `MaskBuffer`.
1 parent bb3dd0b commit 4498375

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Diff for: src/gemm.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,19 @@ const MASK_BUF_SIZE: usize = KERNEL_MAX_SIZE + KERNEL_MAX_ALIGN - 1;
345345
// we don't get aligned allocations out of TLS - 16- and 8-byte
346346
// allocations have been seen, make the minimal align request we can.
347347
// Align(32) would not work with TLS for s390x.
348-
#[cfg_attr(not(target_os = "macos"), repr(align(16)))]
348+
#[cfg_attr(
349+
not(any(
350+
target_os = "macos",
351+
// Target i686-win7-windows-msvc <https://github.com/rust-lang/rust/issues/138903>
352+
all(
353+
target_arch = "x86",
354+
target_vendor = "win7",
355+
target_os = "windows",
356+
target_env = "msvc"
357+
)
358+
)),
359+
repr(align(16))
360+
)]
349361
struct MaskBuffer {
350362
buffer: [u8; MASK_BUF_SIZE],
351363
}

0 commit comments

Comments
 (0)