From bde91785dc4de27787ac20074f3fda70ec47c88d Mon Sep 17 00:00:00 2001 From: Oneirical Date: Mon, 8 Jul 2024 14:51:01 -0400 Subject: [PATCH] rewrite extern-fn-explicit-align to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - .../run-make/extern-fn-explicit-align/Makefile | 6 ------ .../run-make/extern-fn-explicit-align/rmake.rs | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 7 deletions(-) delete mode 100644 tests/run-make/extern-fn-explicit-align/Makefile create mode 100644 tests/run-make/extern-fn-explicit-align/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 51614f84ec3..fde065b929b 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -24,7 +24,6 @@ run-make/emit-to-stdout/Makefile run-make/export-executable-symbols/Makefile run-make/extern-diff-internal-name/Makefile run-make/extern-flag-disambiguates/Makefile -run-make/extern-fn-explicit-align/Makefile run-make/extern-fn-generic/Makefile run-make/extern-fn-mangle/Makefile run-make/extern-fn-reachable/Makefile diff --git a/tests/run-make/extern-fn-explicit-align/Makefile b/tests/run-make/extern-fn-explicit-align/Makefile deleted file mode 100644 index 3cbbf383996..00000000000 --- a/tests/run-make/extern-fn-explicit-align/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-explicit-align/rmake.rs b/tests/run-make/extern-fn-explicit-align/rmake.rs new file mode 100644 index 00000000000..fb153f92103 --- /dev/null +++ b/tests/run-make/extern-fn-explicit-align/rmake.rs @@ -0,0 +1,17 @@ +// The compiler's rules of alignment for indirectly passed values in a 16-byte aligned argument, +// in a C external function, used to be arbitrary. Unexpected behavior would occasionally occur +// and cause memory corruption. This was fixed in #112157, streamlining the way alignment occurs, +// and this test reproduces the case featured in the issue, checking that it compiles and executes +// successfully. +// See https://github.com/rust-lang/rust/issues/80127 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_static_lib, run, rustc}; + +fn main() { + build_native_static_lib("test"); + rustc().input("test.rs").run(); + run("test"); +}