-
Notifications
You must be signed in to change notification settings - Fork 109
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.
Description
I've so far reduced it to
#![feature(portable_simd)]
use core_simd::simd::prelude::*;
use test_helpers::*;
#[test]
fn lanes_3() {
test_1(&|x: [usize; 3]| {
let result_1: [u8; 3] = Simd::<usize, 3>::cast::<u8>(x.into()).into();
let result_2: [u8; 3] =
x.iter().copied().map(|x| x as u8).collect::<Vec<_>>().try_into().unwrap();
proptest::prop_assert_eq!(&result_1, &result_2);
Ok(())
});
}
dist/cargo-clif build --manifest-path build/portable-simd/crates/core_simd/Cargo.toml --test cast && __RUST_TEST_INVOKE=lanes_3 build/portable-simd/target/debug/deps/cast-13b6f2e0b7cfecc1
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.02s
Segmentation fault (core dumped)
This crash is not consistent and seems to depend on the ASLR seed.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
bjorn3 commentedon Feb 12, 2025
With
RUSTFLAGS="-Zmir-opt-level=0"
the crash happens at:bjorn3 commentedon Feb 12, 2025
I suspect I messed up the alignment logic in
create_stack_slot
. Adding+ 1
torustc_codegen_cranelift/src/common.rs
Line 402 in 28a241f
bjorn3 commentedon Feb 13, 2025
Turns out at multiple places I was using the preferred alignment rather than abi alignment and the size is not necessarily a multiple of the preferred alignment, while it is always a multiple of the abi alignment.
create_stack_slot
was written under the assumption that the size is a multiple of the passed in alignment.bjorn3 commentedon Feb 13, 2025
Fixed by c27715b
bjorn3 commentedon Feb 15, 2025
rust-lang/rust#137078 will sync the subtree.
Auto merge of rust-lang#137078 - bjorn3:sync_cg_clif-2025-02-15, r=bj…
Auto merge of #137078 - bjorn3:sync_cg_clif-2025-02-15, r=bjorn3
Remove rustc's notion of "preferred" alignment AKA `__alignof`
__alignof
rust-lang/rust#141803Rollup merge of rust-lang#141803 - workingjubilee:remove-pref-align, …
2 remaining items