about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-08 14:51:01 -0400
committerOneirical <manchot@videotron.ca>2024-07-17 15:33:07 -0400
commitbde91785dc4de27787ac20074f3fda70ec47c88d (patch)
treeafe919e87d8d15729130bac81b388d04e7b805cb
parent205bfe72130fc9ea3eb646a5d3d59d0525b8d708 (diff)
rewrite extern-fn-explicit-align to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/extern-fn-explicit-align/Makefile6
-rw-r--r--tests/run-make/extern-fn-explicit-align/rmake.rs17
3 files changed, 17 insertions, 7 deletions
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");
+}