]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add test case for using asm! outside of unsafe {}
authorjjasmine <tanghocle456@gmail.com>
Sat, 22 Jun 2024 06:38:10 +0000 (23:38 -0700)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 17 Mar 2025 15:35:49 +0000 (16:35 +0100)
gcc/testsuite/ChangeLog:

* rust/compile/inline_asm_outside_unsafe.rs: New test.

gcc/testsuite/rust/compile/inline_asm_outside_unsafe.rs [new file with mode: 0644]

diff --git a/gcc/testsuite/rust/compile/inline_asm_outside_unsafe.rs b/gcc/testsuite/rust/compile/inline_asm_outside_unsafe.rs
new file mode 100644 (file)
index 0000000..02b9ab0
--- /dev/null
@@ -0,0 +1,11 @@
+#![feature(rustc_attrs)]
+
+#[rustc_builtin_macro]
+macro_rules! asm {
+    () => {}
+}
+
+fn main() {
+    asm!("nop"); // { dg-error "use of inline assembly is unsafe and requires unsafe function or block" }
+}
+