Add tests to demonstrate explicit tail call bug

This commit is contained in:
Mark Z. Ding 2025-10-29 09:33:38 -04:00
parent 907705abea
commit 3a02b357d3
2 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,22 @@
//@ check-pass
//@ ignore-backends: gcc
//@ known-bug: #148239
//@ compile-flags: -Zno-codegen
#![expect(incomplete_features)]
#![feature(explicit_tail_calls)]
#[inline(never)]
fn leaf(_: &Box<u8>) -> [u8; 1] {
[1]
}
#[inline(never)]
fn dispatch(param: &Box<u8>) -> [u8; 1] {
become leaf(param)
}
fn main() {
let data = Box::new(0);
let out = dispatch(&data);
assert_eq!(out, [1]);
}

View file

@ -0,0 +1,21 @@
//@ run-pass
//@ ignore-backends: gcc
//@ known-bug: #148239
#![expect(incomplete_features)]
#![feature(explicit_tail_calls)]
#[inline(never)]
fn op_dummy(_param: &Box<u8>) -> [u8; 24] {
[1; 24]
}
#[inline(never)]
fn dispatch(param: &Box<u8>) -> [u8; 24] {
become op_dummy(param)
}
fn main() {
let param = Box::new(0);
let result = dispatch(&param);
assert_ne!(result, [1; 24]); // the data is not right!
}