summaryrefslogtreecommitdiffstats
path: root/src/test/run-make-fulldeps/issue-97463-abi-param-passing
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /src/test/run-make-fulldeps/issue-97463-abi-param-passing
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/run-make-fulldeps/issue-97463-abi-param-passing')
-rw-r--r--src/test/run-make-fulldeps/issue-97463-abi-param-passing/Makefile14
-rw-r--r--src/test/run-make-fulldeps/issue-97463-abi-param-passing/bad.c24
-rw-r--r--src/test/run-make-fulldeps/issue-97463-abi-param-passing/param_passing.rs38
3 files changed, 0 insertions, 76 deletions
diff --git a/src/test/run-make-fulldeps/issue-97463-abi-param-passing/Makefile b/src/test/run-make-fulldeps/issue-97463-abi-param-passing/Makefile
deleted file mode 100644
index db1b53e15..000000000
--- a/src/test/run-make-fulldeps/issue-97463-abi-param-passing/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
--include ../tools.mk
-
-# ignore-msvc
-
-# The issue exercised by this test, rust-lang/rust#97463, explicitly needs `-O`
-# flags (like `-O3`) to reproduce. Thus, we call $(CC) instead of nicer
-# alternatives provided by tools.mk like using `COMPILE_OBJ` or using a
-# `NATIVE_STATICLIB` dependency.
-
-all:
- $(CC) -c -O3 -o $(TMPDIR)/bad.o bad.c
- $(AR) rcs $(TMPDIR)/libbad.a $(TMPDIR)/bad.o
- $(RUSTC) param_passing.rs -L$(TMPDIR) -lbad -C opt-level=3
- $(call RUN,param_passing)
diff --git a/src/test/run-make-fulldeps/issue-97463-abi-param-passing/bad.c b/src/test/run-make-fulldeps/issue-97463-abi-param-passing/bad.c
deleted file mode 100644
index 013314ab2..000000000
--- a/src/test/run-make-fulldeps/issue-97463-abi-param-passing/bad.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdio.h>
-
-
-struct bloc {
- uint16_t a;
- uint16_t b;
- uint16_t c;
-};
-
-uint16_t c_read_value(uint32_t a, uint32_t b, uint32_t c) {
- struct bloc *data = malloc(sizeof(struct bloc));
-
- data->a = a & 0xFFFF;
- data->b = b & 0xFFFF;
- data->c = c & 0xFFFF;
-
- printf("C struct: a = %u, b = %u, c = %u\n",
- (unsigned) data->a, (unsigned) data->b, (unsigned) data->c);
- printf("C function returns %u\n", (unsigned) data->b);
-
- return data->b; /* leak data */
-}
diff --git a/src/test/run-make-fulldeps/issue-97463-abi-param-passing/param_passing.rs b/src/test/run-make-fulldeps/issue-97463-abi-param-passing/param_passing.rs
deleted file mode 100644
index c11f3cc72..000000000
--- a/src/test/run-make-fulldeps/issue-97463-abi-param-passing/param_passing.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-// NOTE: Exposing the bug encoded in this test is sensitive to
-// LLVM optimization choices. See additional note below for an
-// example.
-
-#[link(name = "bad")]
-extern "C" {
- pub fn c_read_value(a: u32, b: u32, c: u32) -> u16;
-}
-
-fn main() {
- const C1: usize = 0x327b23c6;
- const C2: usize = C1 & 0xFFFF;
-
- let r1: usize = 0x0;
- let r2: usize = C1;
- let r3: usize = 0x0;
- let value: u16 = unsafe { c_read_value(r1 as u32, r2 as u32, r3 as u32) };
-
- // NOTE: as an example of the sensitivity of this test to optimization choices,
- // uncommenting this block of code makes the bug go away on pnkfelix's machine.
- // (But observing via `dbg!` doesn't hide the bug. At least sometimes.)
- /*
- println!("{}", value);
- println!("{}", value as usize);
- println!("{}", usize::from(value));
- println!("{}", (value as usize) & 0xFFFF);
- */
-
- let d1 = value;
- let d2 = value as usize;
- let d3 = usize::from(value);
- let d4 = (value as usize) & 0xFFFF;
-
- let d = (&d1, &d2, &d3, &d4);
- let d_ = (d1, d2, d3, d4);
-
- assert_eq!(((&(C2 as u16), &C2, &C2, &C2), (C2 as u16, C2, C2, C2)), (d, d_));
-}