Skip to content

Commit c8849a9

Browse files
committed
Fix undefined behavior is SSE4.2 test
This was causing aborts with debug builds of the standard library. Fixes #1336
1 parent 790411f commit c8849a9

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

crates/core_arch/src/x86/sse42.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -623,11 +623,7 @@ mod tests {
623623
unsafe fn str_to_m128i(s: &[u8]) -> __m128i {
624624
assert!(s.len() <= 16);
625625
let slice = &mut [0u8; 16];
626-
ptr::copy_nonoverlapping(
627-
s.get_unchecked(0) as *const u8 as *const u8,
628-
slice.get_unchecked_mut(0) as *mut u8 as *mut u8,
629-
s.len(),
630-
);
626+
ptr::copy_nonoverlapping(s.as_ptr(), slice.as_mut_ptr(), s.len());
631627
_mm_loadu_si128(slice.as_ptr() as *const _)
632628
}
633629

0 commit comments

Comments
 (0)