about summary refs log tree commit diff
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2023-03-12 12:57:40 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2023-03-12 12:57:40 -0700
commit0b96fee34315b75c8f05ce338d3beb6c85772056 (patch)
tree1ad0e1a90dc6e86f53e0f731ddaa347569b40c60
parentb2c717fa338dd3e917008484c4bf55886041f743 (diff)
downloadrust-0b96fee34315b75c8f05ce338d3beb6c85772056.tar.gz
rust-0b96fee34315b75c8f05ce338d3beb6c85772056.zip
Add a codegen test to confirm this fixes 106369
-rw-r--r--tests/codegen/issues/issue-106369.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/codegen/issues/issue-106369.rs b/tests/codegen/issues/issue-106369.rs
new file mode 100644
index 00000000000..3fe7be4f144
--- /dev/null
+++ b/tests/codegen/issues/issue-106369.rs
@@ -0,0 +1,15 @@
+// compile-flags: -O
+// ignore-debug (the extra assertions get in the way)
+
+#![crate_type = "lib"]
+
+// From <https://github.com/rust-lang/rust/issues/106369#issuecomment-1369095304>
+
+// CHECK-LABEL: @issue_106369(
+#[no_mangle]
+pub unsafe fn issue_106369(ptr: *const &i32) -> bool {
+    // CHECK-NOT: icmp
+    // CHECK: ret i1 true
+    // CHECK-NOT: icmp
+    Some(std::ptr::read(ptr)).is_some()
+}