Skip to content
Permalink
Browse files

Add more regression tests for accidental promotion

  • Loading branch information...
oli-obk committed Apr 5, 2019
1 parent 1f40580 commit 65a45dd99dac63a2b0296042726ff61fe2399353
@@ -647,7 +647,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
}

LocalKind::Temp if !temps[local].is_promotable() => {
cx.per_local[IsNotPromotable].insert(local);
cx.per_local[IsNotConst].insert(local);
}

_ => {}
@@ -825,7 +825,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
// be replaced with calling `insert` to re-set the bit).
if kind == LocalKind::Temp {
if !self.temp_promotion_state[index].is_promotable() {
assert!(self.cx.per_local[IsNotPromotable].contains(index));
assert!(self.cx.per_local[IsNotConst].contains(index));
}
}
}
@@ -0,0 +1,11 @@
#[cfg(target_arch = "x86")]
use std::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use std::arch::x86_64::*;

unsafe fn pclmul(a: __m128i, b: __m128i) -> __m128i {
let imm8 = 3;
_mm_clmulepi64_si128(a, b, imm8) //~ ERROR argument 3 is required to be a constant
}

fn main() {}
@@ -0,0 +1,8 @@
error: argument 3 is required to be a constant
--> $DIR/const_arg_local.rs:8:5
|
LL | _mm_clmulepi64_si128(a, b, imm8)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

@@ -0,0 +1,10 @@
#[cfg(target_arch = "x86")]
use std::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use std::arch::x86_64::*;

unsafe fn pclmul(a: __m128i, b: __m128i) -> __m128i {
_mm_clmulepi64_si128(a, b, *&mut 42) //~ ERROR argument 3 is required to be a constant
}

fn main() {}
@@ -0,0 +1,8 @@
error: argument 3 is required to be a constant
--> $DIR/const_arg_promotable.rs:7:5
|
LL | _mm_clmulepi64_si128(a, b, *&mut 42)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

0 comments on commit 65a45dd

Please sign in to comment.
You can’t perform that action at this time.