]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Fix infinite loop on inline assembly clobbers
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Mon, 11 Aug 2025 14:22:32 +0000 (16:22 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 30 Oct 2025 19:58:37 +0000 (20:58 +0100)
Fix Rust-GCC/gccrs#4046 where the inline llvm_asm macro parser did not
expect a comma.

gcc/rust/ChangeLog:

* expand/rust-macro-builtins-asm.cc (parse_llvm_clobbers): Expect a
comma between clobbers.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/expand/rust-macro-builtins-asm.cc

index 4080a22cfae0c59373f3243707a43aea55c8a1a9..6cbcf87ebc9a84c92ad4188e6288d1f33420593e 100644 (file)
@@ -1125,8 +1125,11 @@ parse_llvm_clobbers (LlvmAsmContext &ctx)
        {
          ctx.llvm_asm.get_clobbers ().push_back (
            {strip_double_quotes (token->as_string ()), token->get_locus ()});
+
+         parser.skip_token (STRING_LITERAL);
        }
-      parser.skip_token (STRING_LITERAL);
+
+      parser.maybe_skip_token (COMMA);
       token = parser.peek_current_token ();
     }
 }