Skip to content

Commit 3a02b35

Browse files
Add tests to demonstrate explicit tail call bug
1 parent 907705a commit 3a02b35

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//@ check-pass
2+
//@ ignore-backends: gcc
3+
//@ known-bug: #148239
4+
//@ compile-flags: -Zno-codegen
5+
#![expect(incomplete_features)]
6+
#![feature(explicit_tail_calls)]
7+
8+
#[inline(never)]
9+
fn leaf(_: &Box<u8>) -> [u8; 1] {
10+
[1]
11+
}
12+
13+
#[inline(never)]
14+
fn dispatch(param: &Box<u8>) -> [u8; 1] {
15+
become leaf(param)
16+
}
17+
18+
fn main() {
19+
let data = Box::new(0);
20+
let out = dispatch(&data);
21+
assert_eq!(out, [1]);
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@ run-pass
2+
//@ ignore-backends: gcc
3+
//@ known-bug: #148239
4+
#![expect(incomplete_features)]
5+
#![feature(explicit_tail_calls)]
6+
7+
#[inline(never)]
8+
fn op_dummy(_param: &Box<u8>) -> [u8; 24] {
9+
[1; 24]
10+
}
11+
12+
#[inline(never)]
13+
fn dispatch(param: &Box<u8>) -> [u8; 24] {
14+
become op_dummy(param)
15+
}
16+
17+
fn main() {
18+
let param = Box::new(0);
19+
let result = dispatch(&param);
20+
assert_ne!(result, [1; 24]); // the data is not right!
21+
}

0 commit comments

Comments
 (0)