]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Added faulty tests for inline asm cloberring
authorjjasmine <tanghocle456@gmail.com>
Wed, 22 May 2024 02:45:35 +0000 (19:45 -0700)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 17 Mar 2025 15:35:39 +0000 (16:35 +0100)
gcc/testsuite/ChangeLog:

* rust/compile/inline_asm_faulty_clobber.rs: New test.
* rust/compile/inline_asm_faulty_clobber_1.rs: New test.
* rust/compile/inline_asm_faulty_clobber_2.rs: New test.

gcc/testsuite/rust/compile/inline_asm_faulty_clobber.rs [new file with mode: 0644]
gcc/testsuite/rust/compile/inline_asm_faulty_clobber_1.rs [new file with mode: 0644]
gcc/testsuite/rust/compile/inline_asm_faulty_clobber_2.rs [new file with mode: 0644]

diff --git a/gcc/testsuite/rust/compile/inline_asm_faulty_clobber.rs b/gcc/testsuite/rust/compile/inline_asm_faulty_clobber.rs
new file mode 100644 (file)
index 0000000..8d040ea
--- /dev/null
@@ -0,0 +1,10 @@
+#![feature(rustc_attrs)]
+
+#[rustc_builtin_macro]
+macro_rules! asm {
+    () => {}
+}
+
+fn main() {
+    asm!("nop", clobber_abi());  // { dg-error "at least one abi must be provided as an argument to `clobber_abi`" }
+}
\ No newline at end of file
diff --git a/gcc/testsuite/rust/compile/inline_asm_faulty_clobber_1.rs b/gcc/testsuite/rust/compile/inline_asm_faulty_clobber_1.rs
new file mode 100644 (file)
index 0000000..77af101
--- /dev/null
@@ -0,0 +1,10 @@
+#![feature(rustc_attrs)]
+
+#[rustc_builtin_macro]
+macro_rules! asm {
+    () => {}
+}
+
+fn main() {
+    asm!("nop", clobber_abi);  // { dg-error "expected `\\(`, found end of macro arguments" }
+}
\ No newline at end of file
diff --git a/gcc/testsuite/rust/compile/inline_asm_faulty_clobber_2.rs b/gcc/testsuite/rust/compile/inline_asm_faulty_clobber_2.rs
new file mode 100644 (file)
index 0000000..ae3607f
--- /dev/null
@@ -0,0 +1,10 @@
+#![feature(rustc_attrs)]
+
+#[rustc_builtin_macro]
+macro_rules! asm {
+    () => {}
+}
+
+fn main() {
+    asm!("nop", clobber_abi+);  // { dg-error "expected `\\(`, found `\\+`" }
+}
\ No newline at end of file