Fix ICE in const eval of packed SIMD types with non-power-of-two element counts#151628
Conversation
|
r? @nnethercote rustbot has assigned @nnethercote. Use |
This comment has been minimized.
This comment has been minimized.
|
cc @folkertdev |
|
I discussed this with @workingjubilee, and the true underlying issue is more complicated. Really we should not be using However we might want this fix in the meantime (though with a |
so, what should we do now? implement this fix and add a comment? |
|
Let's see if Jubilee can give an indication on how quickly this can be fixed. You can add the comment already. If nothing else it'll re-run CI and hopefully pass this time. |
got it, thanks. also i would like to work on fix in future, if needed :) |
805a3cf to
5baf4e6
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
r? me |
There was a problem hiding this comment.
Please add a link to the issue that is fixed by this PR as a comment inside this test.
…ngth Packed SIMD types with non-power-of-two element counts use BackendRepr::Memory instead of BackendRepr::SimdVector. The check_simd_ptr_alignment function now handles both cases to prevent ICEs when evaluating SIMD intrinsics in const contexts.
5baf4e6 to
c45a513
Compare
|
I'll approve now; @workingjubilee please chime in asynchronously if you think that's a mistake. |
… r=RalfJung Fix ICE in const eval of packed SIMD types with non-power-of-two element counts fixes rust-lang#151537 const evaluation of packed SIMD types with non-power-of-two element counts (like `Simd<_, 3>`) was hitting an ICE. the issue was in `check_simd_ptr_alignment` - it asserted that `backend_repr` must be `BackendRepr::SimdVector`, but for packed SIMD types with non-power-of-two counts the compiler uses `BackendRepr::Memory` instead (as mentioned in `rustc_abi/src/layout.rs:1511`). was fixed by making `check_simd_ptr_alignment` accept both `BackendRepr::SimdVector` and `BackendRepr::Memory` for SIMD types. added a check to ensure we're dealing with a SIMD type, and the alignment logic works the same for both representations. also i added a test that reproduces the original ICE.
Rollup of 14 pull requests Successful merges: - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing) - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts) - #151740 (Fix short backtraces from stripped executables) - #151871 (don't use env with infer vars) - #152591 (Simplify internals of `{Rc,Arc}::default`) - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned) - #152908 (Enable rust.remap-debuginfo in the dist profile) - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7) - #152767 (fix typo in `carryless_mul` macro invocation) - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`) - #152871 (Fix warnings in rs{begin,end}.rs files) - #152921 (Add build.rustdoc option to bootstrap config) - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint) - #152937 (remove unneeded reboxing)
… r=RalfJung Fix ICE in const eval of packed SIMD types with non-power-of-two element counts fixes rust-lang#151537 const evaluation of packed SIMD types with non-power-of-two element counts (like `Simd<_, 3>`) was hitting an ICE. the issue was in `check_simd_ptr_alignment` - it asserted that `backend_repr` must be `BackendRepr::SimdVector`, but for packed SIMD types with non-power-of-two counts the compiler uses `BackendRepr::Memory` instead (as mentioned in `rustc_abi/src/layout.rs:1511`). was fixed by making `check_simd_ptr_alignment` accept both `BackendRepr::SimdVector` and `BackendRepr::Memory` for SIMD types. added a check to ensure we're dealing with a SIMD type, and the alignment logic works the same for both representations. also i added a test that reproduces the original ICE.
Rollup of 15 pull requests Successful merges: - #149366 (GVN: consider constants of primitive types as deterministic) - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing) - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts) - #151871 (don't use env with infer vars) - #152591 (Simplify internals of `{Rc,Arc}::default`) - #152657 (std: move `exit` out of PAL) - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned) - #152908 (Enable rust.remap-debuginfo in the dist profile) - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7) - #152767 (fix typo in `carryless_mul` macro invocation) - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`) - #152871 (Fix warnings in rs{begin,end}.rs files) - #152921 (Add build.rustdoc option to bootstrap config) - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint) - #152937 (remove unneeded reboxing)
… r=RalfJung Fix ICE in const eval of packed SIMD types with non-power-of-two element counts fixes rust-lang#151537 const evaluation of packed SIMD types with non-power-of-two element counts (like `Simd<_, 3>`) was hitting an ICE. the issue was in `check_simd_ptr_alignment` - it asserted that `backend_repr` must be `BackendRepr::SimdVector`, but for packed SIMD types with non-power-of-two counts the compiler uses `BackendRepr::Memory` instead (as mentioned in `rustc_abi/src/layout.rs:1511`). was fixed by making `check_simd_ptr_alignment` accept both `BackendRepr::SimdVector` and `BackendRepr::Memory` for SIMD types. added a check to ensure we're dealing with a SIMD type, and the alignment logic works the same for both representations. also i added a test that reproduces the original ICE.
Rollup of 14 pull requests Successful merges: - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing) - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts) - #151871 (don't use env with infer vars) - #152591 (Simplify internals of `{Rc,Arc}::default`) - #152657 (std: move `exit` out of PAL) - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned) - #152908 (Enable rust.remap-debuginfo in the dist profile) - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7) - #152767 (fix typo in `carryless_mul` macro invocation) - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`) - #152871 (Fix warnings in rs{begin,end}.rs files) - #152921 (Add build.rustdoc option to bootstrap config) - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint) - #152937 (remove unneeded reboxing)
… r=RalfJung Fix ICE in const eval of packed SIMD types with non-power-of-two element counts fixes rust-lang#151537 const evaluation of packed SIMD types with non-power-of-two element counts (like `Simd<_, 3>`) was hitting an ICE. the issue was in `check_simd_ptr_alignment` - it asserted that `backend_repr` must be `BackendRepr::SimdVector`, but for packed SIMD types with non-power-of-two counts the compiler uses `BackendRepr::Memory` instead (as mentioned in `rustc_abi/src/layout.rs:1511`). was fixed by making `check_simd_ptr_alignment` accept both `BackendRepr::SimdVector` and `BackendRepr::Memory` for SIMD types. added a check to ensure we're dealing with a SIMD type, and the alignment logic works the same for both representations. also i added a test that reproduces the original ICE.
Rollup of 13 pull requests Successful merges: - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing) - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts) - #151871 (don't use env with infer vars) - #152591 (Simplify internals of `{Rc,Arc}::default`) - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned) - #152908 (Enable rust.remap-debuginfo in the dist profile) - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7) - #152767 (fix typo in `carryless_mul` macro invocation) - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`) - #152871 (Fix warnings in rs{begin,end}.rs files) - #152921 (Add build.rustdoc option to bootstrap config) - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint) - #152937 (remove unneeded reboxing)
… r=RalfJung Fix ICE in const eval of packed SIMD types with non-power-of-two element counts fixes rust-lang#151537 const evaluation of packed SIMD types with non-power-of-two element counts (like `Simd<_, 3>`) was hitting an ICE. the issue was in `check_simd_ptr_alignment` - it asserted that `backend_repr` must be `BackendRepr::SimdVector`, but for packed SIMD types with non-power-of-two counts the compiler uses `BackendRepr::Memory` instead (as mentioned in `rustc_abi/src/layout.rs:1511`). was fixed by making `check_simd_ptr_alignment` accept both `BackendRepr::SimdVector` and `BackendRepr::Memory` for SIMD types. added a check to ensure we're dealing with a SIMD type, and the alignment logic works the same for both representations. also i added a test that reproduces the original ICE.
Rollup of 15 pull requests Successful merges: - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing) - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts) - #151871 (don't use env with infer vars) - #152591 (Simplify internals of `{Rc,Arc}::default`) - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned) - #152908 (Enable rust.remap-debuginfo in the dist profile) - #147859 (reduce the amount of panics in `{TokenStream, Literal}::from_str` calls) - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7) - #152767 (fix typo in `carryless_mul` macro invocation) - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`) - #152871 (Fix warnings in rs{begin,end}.rs files) - #152879 (Remove `impl IntoQueryParam<P> for &'a P`.) - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint) - #152937 (remove unneeded reboxing) - #152953 (Fix typo in armv7a-vex-v5.md)
… r=RalfJung Fix ICE in const eval of packed SIMD types with non-power-of-two element counts fixes rust-lang#151537 const evaluation of packed SIMD types with non-power-of-two element counts (like `Simd<_, 3>`) was hitting an ICE. the issue was in `check_simd_ptr_alignment` - it asserted that `backend_repr` must be `BackendRepr::SimdVector`, but for packed SIMD types with non-power-of-two counts the compiler uses `BackendRepr::Memory` instead (as mentioned in `rustc_abi/src/layout.rs:1511`). was fixed by making `check_simd_ptr_alignment` accept both `BackendRepr::SimdVector` and `BackendRepr::Memory` for SIMD types. added a check to ensure we're dealing with a SIMD type, and the alignment logic works the same for both representations. also i added a test that reproduces the original ICE.
…uwer Rollup of 14 pull requests Successful merges: - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing) - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts) - #151871 (don't use env with infer vars) - #152591 (Simplify internals of `{Rc,Arc}::default`) - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned) - #147859 (reduce the amount of panics in `{TokenStream, Literal}::from_str` calls) - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7) - #152767 (fix typo in `carryless_mul` macro invocation) - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`) - #152871 (Fix warnings in rs{begin,end}.rs files) - #152879 (Remove `impl IntoQueryParam<P> for &'a P`.) - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint) - #152937 (remove unneeded reboxing) - #152953 (Fix typo in armv7a-vex-v5.md)
…uwer Rollup of 14 pull requests Successful merges: - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing) - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts) - #151871 (don't use env with infer vars) - #152591 (Simplify internals of `{Rc,Arc}::default`) - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned) - #147859 (reduce the amount of panics in `{TokenStream, Literal}::from_str` calls) - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7) - #152767 (fix typo in `carryless_mul` macro invocation) - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`) - #152871 (Fix warnings in rs{begin,end}.rs files) - #152879 (Remove `impl IntoQueryParam<P> for &'a P`.) - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint) - #152937 (remove unneeded reboxing) - #152953 (Fix typo in armv7a-vex-v5.md)
Rollup merge of #151628 - enthropy7:fix-simd-const-eval-ice, r=RalfJung Fix ICE in const eval of packed SIMD types with non-power-of-two element counts fixes #151537 const evaluation of packed SIMD types with non-power-of-two element counts (like `Simd<_, 3>`) was hitting an ICE. the issue was in `check_simd_ptr_alignment` - it asserted that `backend_repr` must be `BackendRepr::SimdVector`, but for packed SIMD types with non-power-of-two counts the compiler uses `BackendRepr::Memory` instead (as mentioned in `rustc_abi/src/layout.rs:1511`). was fixed by making `check_simd_ptr_alignment` accept both `BackendRepr::SimdVector` and `BackendRepr::Memory` for SIMD types. added a check to ensure we're dealing with a SIMD type, and the alignment logic works the same for both representations. also i added a test that reproduces the original ICE.
…uwer Rollup of 14 pull requests Successful merges: - rust-lang/rust#150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing) - rust-lang/rust#151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts) - rust-lang/rust#151871 (don't use env with infer vars) - rust-lang/rust#152591 (Simplify internals of `{Rc,Arc}::default`) - rust-lang/rust#152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned) - rust-lang/rust#147859 (reduce the amount of panics in `{TokenStream, Literal}::from_str` calls) - rust-lang/rust#152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7) - rust-lang/rust#152767 (fix typo in `carryless_mul` macro invocation) - rust-lang/rust#152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`) - rust-lang/rust#152871 (Fix warnings in rs{begin,end}.rs files) - rust-lang/rust#152879 (Remove `impl IntoQueryParam<P> for &'a P`.) - rust-lang/rust#152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint) - rust-lang/rust#152937 (remove unneeded reboxing) - rust-lang/rust#152953 (Fix typo in armv7a-vex-v5.md)
…uwer Rollup of 14 pull requests Successful merges: - rust-lang/rust#150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing) - rust-lang/rust#151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts) - rust-lang/rust#151871 (don't use env with infer vars) - rust-lang/rust#152591 (Simplify internals of `{Rc,Arc}::default`) - rust-lang/rust#152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned) - rust-lang/rust#147859 (reduce the amount of panics in `{TokenStream, Literal}::from_str` calls) - rust-lang/rust#152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7) - rust-lang/rust#152767 (fix typo in `carryless_mul` macro invocation) - rust-lang/rust#152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`) - rust-lang/rust#152871 (Fix warnings in rs{begin,end}.rs files) - rust-lang/rust#152879 (Remove `impl IntoQueryParam<P> for &'a P`.) - rust-lang/rust#152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint) - rust-lang/rust#152937 (remove unneeded reboxing) - rust-lang/rust#152953 (Fix typo in armv7a-vex-v5.md)
fixes #151537
const evaluation of packed SIMD types with non-power-of-two element counts (like
Simd<_, 3>) was hitting an ICE. the issue was incheck_simd_ptr_alignment- it asserted thatbackend_reprmust beBackendRepr::SimdVector, but for packed SIMD types with non-power-of-two counts the compiler usesBackendRepr::Memoryinstead (as mentioned inrustc_abi/src/layout.rs:1511).was fixed by making
check_simd_ptr_alignmentaccept bothBackendRepr::SimdVectorandBackendRepr::Memoryfor SIMD types. added a check to ensure we're dealing with a SIMD type, and the alignment logic works the same for both representations.also i added a test that reproduces the original ICE.