rewrite and rename issue-20626 to rmake

This commit is contained in:
Oneirical 2024-06-25 15:02:19 -04:00
parent fe2406bcef
commit ee529b72f9
4 changed files with 16 additions and 10 deletions

View File

@ -60,7 +60,6 @@ run-make/issue-109934-lto-debuginfo/Makefile
run-make/issue-14698/Makefile run-make/issue-14698/Makefile
run-make/issue-15460/Makefile run-make/issue-15460/Makefile
run-make/issue-18943/Makefile run-make/issue-18943/Makefile
run-make/issue-20626/Makefile
run-make/issue-22131/Makefile run-make/issue-22131/Makefile
run-make/issue-25581/Makefile run-make/issue-25581/Makefile
run-make/issue-26006/Makefile run-make/issue-26006/Makefile

View File

@ -1,9 +0,0 @@
# ignore-cross-compile
include ../tools.mk
# Test output to be four
# The original error only occurred when printing, not when comparing using assert!
all:
$(RUSTC) foo.rs -O
[ `$(call RUN,foo)` = "4" ]

View File

@ -0,0 +1,16 @@
// Despite the absence of any unsafe Rust code, foo.rs in this test would,
// because of the raw function pointer,
// cause undefined behavior and fail to print the expected result, "4" -
// only when activating optimizations (opt-level 2). This test checks
// that this bug does not make a resurgence.
// Note that the bug cannot be observed in an assert_eq!, only in the stdout.
// See https://github.com/rust-lang/rust/issues/20626
//@ ignore-cross-compile
use run_make_support::{run, rustc};
fn main() {
rustc().input("foo.rs").opt().run();
run("foo").assert_stdout_equals("4");
}