about summary refs log tree commit diff
path: root/tests/crashes/144293-indirect-ops-llvm.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/crashes/144293-indirect-ops-llvm.rs')
-rw-r--r--tests/crashes/144293-indirect-ops-llvm.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/crashes/144293-indirect-ops-llvm.rs b/tests/crashes/144293-indirect-ops-llvm.rs
new file mode 100644
index 00000000000..490a0116d7d
--- /dev/null
+++ b/tests/crashes/144293-indirect-ops-llvm.rs
@@ -0,0 +1,42 @@
+//@ known-bug: #144293
+// Same as recursion-etc but eggs LLVM emission into giving indirect arguments.
+#![expect(incomplete_features)]
+#![feature(explicit_tail_calls)]
+
+use std::hint::black_box;
+
+struct U64Wrapper {
+    pub x: u64,
+    pub arbitrary: String,
+}
+
+fn count(curr: U64Wrapper, top: U64Wrapper) -> U64Wrapper {
+    if black_box(curr.x) >= top.x {
+        curr
+    } else {
+        become count(
+            U64Wrapper {
+                x: curr.x + 1,
+                arbitrary: curr.arbitrary,
+            },
+            top,
+        )
+    }
+}
+
+fn main() {
+    println!(
+        "{}",
+        count(
+            U64Wrapper {
+                x: 0,
+                arbitrary: "hello!".into()
+            },
+            black_box(U64Wrapper {
+                x: 1000000,
+                arbitrary: "goodbye!".into()
+            })
+        )
+        .x
+    );
+}