Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit 85a4fca

Browse files
committed
Add some inline ASM crashes
1 parent 77029d8 commit 85a4fca

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed

ices/59184.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#![feature(asm)]
2+
3+
fn main()
4+
{
5+
println!("Hello, world! {}", read_after_raising_any_exceptions());
6+
}
7+
8+
#[inline(never)]
9+
pub fn read_after_raising_any_exceptions() -> u16
10+
{
11+
unsafe
12+
{
13+
// See <https://github.com/HJLebbink/asm-dude/wiki/FSTCW_FNSTCW>.
14+
let mut control_word: u16;
15+
asm!
16+
(
17+
"fstcw $0"
18+
:
19+
// Output constraints.
20+
"=m"(control_word)
21+
:
22+
// Input constraints.
23+
:
24+
// Clobbers.
25+
:
26+
// Options.
27+
"volatile"
28+
);
29+
control_word
30+
}
31+
}

ices/66223.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
rustc -C opt-level=3 - << 'END'
4+
#![feature(llvm_asm)]
5+
6+
unsafe fn _mm512_set1_epi64(a: i64) {
7+
llvm_asm! {
8+
"vpbroadcastq zmm0{k1}, $0"
9+
:: "m"(a)
10+
:: "intel"
11+
}
12+
}
13+
14+
fn main() {
15+
unsafe { _mm512_set1_epi64(123); }
16+
}
17+
END

ices/68136-1.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(asm)]
2+
3+
extern "C" fn foo() { }
4+
5+
fn main() {
6+
unsafe {
7+
asm!("callq $0" :: "s"(foo) :: "volatile");
8+
}
9+
}

ices/68136-2.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![feature(asm)]
2+
3+
extern "C" fn foo() { }
4+
5+
fn main() {
6+
let x: usize;
7+
unsafe {
8+
asm!("movq $1, $0" : "=r"(x) : "r"(foo));
9+
}
10+
assert!(x != 0);
11+
}

0 commit comments

Comments
 (0)