Skip to content

Crash when using Shl/Shr with SIMD types #24258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Apr 10, 2015 · 2 comments
Closed

Crash when using Shl/Shr with SIMD types #24258

ghost opened this issue Apr 10, 2015 · 2 comments
Assignees
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@ghost
Copy link

ghost commented Apr 10, 2015

Minimal test case:

#![feature(core)]
use std::simd::u32x4;
fn main() {
    let a = u32x4(1, 1, 1, 1);
    println!("{:?}", a << a);
}

rustc output:

$ RUST_BACKTRACE=1 rustc main.rs 
rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/include/llvm/Support/Casting.h:237: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::IntegerType; Y = llvm::Type; typename llvm::cast_retty<X, Y*>::ret_type = llvm::IntegerType*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
Aborted (core dumped)

Other operations work fine: I tested Add, BitAnd, BitOr, BitXor, Div, Mul, Rem, Sub. Shl/Shr were the only ones to cause a crash. They worked on SIMD types as of about 3 months ago and the latest documentation claims they're supported.

rustc version:

rustc 1.0.0-nightly (6436e348e 2015-04-08) (built 2015-04-09)
binary: rustc
commit-hash: 6436e348e97a09c2155d0dcd710416e6e0d84371
commit-date: 2015-04-08
build-date: 2015-04-09
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
@sanxiyn
Copy link
Member

sanxiyn commented Apr 10, 2015

This is weird, as this is tested by simd-binop.rs in the test suite.

@jdm jdm added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Apr 10, 2015
@jooert
Copy link
Contributor

jooert commented May 12, 2015

I can confirm this. When compiling with LLVM assertions enabled, I get:

rustc: /path/to/rust/src/llvm/include/llvm/Support/Casting.h:237: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::IntegerType; Y = llvm::Type; typename llvm::cast_retty<X, Y*>::ret_type = llvm::IntegerType*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

(rustc 1.1.0-dev (c44d84da9 2015-05-11))

bors added a commit that referenced this issue Jun 20, 2015
When overflow checking on `<<` and `>>` was added for integers, the `<<` and `>>` operations broke for SIMD types (`u32x4`, `i16x8`, etc.). This PR implements checked shifts on SIMD types.

Fixes #24258.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants