diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2025-07-30 13:11:52 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-08-05 16:36:59 +0200 |
commit | 697025acf8bedcc59a2e34035ddb6f17a69b8c52 (patch) | |
tree | 70e65bf58e036662b378465dde71ed15d1fdb377 /gcc/rust | |
parent | a9fdfc065c3710a26b8a77d2c5d3fc73f4be8371 (diff) | |
download | gcc-697025acf8bedcc59a2e34035ddb6f17a69b8c52.zip gcc-697025acf8bedcc59a2e34035ddb6f17a69b8c52.tar.gz gcc-697025acf8bedcc59a2e34035ddb6f17a69b8c52.tar.bz2 |
gccrs: Fix infinite loop with missing comma
A missing comma between inline assembly templates did not throw an error
and looped indefinitely.
gcc/rust/ChangeLog:
* expand/rust-macro-builtins-asm.cc (parse_format_strings): Emit an
error when expecting a comma.
gcc/testsuite/ChangeLog:
* rust/compile/issue-4006.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/expand/rust-macro-builtins-asm.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/rust/expand/rust-macro-builtins-asm.cc b/gcc/rust/expand/rust-macro-builtins-asm.cc index 9dc234c..61222db 100644 --- a/gcc/rust/expand/rust-macro-builtins-asm.cc +++ b/gcc/rust/expand/rust-macro-builtins-asm.cc @@ -937,7 +937,9 @@ parse_format_strings (InlineAsmContext inline_asm_ctx) { if (!parser.skip_token (COMMA)) { - break; + rust_error_at (parser.peek_current_token ()->get_locus (), + "expected token %qs", ";"); + return tl::unexpected<InlineAsmParseError> (COMMITTED); } // Ok after the comma is good, we better be parsing correctly // everything in here, which is formatted string in ABNF |