https://gcc.gnu.org/g:99812d9d158ddfe775b57ca5713a177cac2ff4c7
commit r17-1886-g99812d9d158ddfe775b57ca5713a177cac2ff4c7 Author: Pierre-Emmanuel Patry <[email protected]> Date: Fri Jun 5 15:33:36 2026 +0200 gccrs: Fix use after move in lexer The str variable was left in an unspecified but valid state after the prior move on the same line. This lead to a value of zero on some platforms and the prefix was considered empty. gcc/rust/ChangeLog: * lex/rust-lex.cc (Lexer::parse_decimal_int_or_float): Prevent use after move. Signed-off-by: Pierre-Emmanuel Patry <[email protected]> Diff: --- gcc/rust/lex/rust-lex.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/rust/lex/rust-lex.cc b/gcc/rust/lex/rust-lex.cc index 900e5890fb3b..4f135b19a34b 100644 --- a/gcc/rust/lex/rust-lex.cc +++ b/gcc/rust/lex/rust-lex.cc @@ -2306,7 +2306,8 @@ Lexer::parse_decimal_int_or_float (location_t loc) loc += length - 1; str.shrink_to_fit (); - return Token::make_float (loc, std::move (str), str.length (), + auto suffix_start = str.length (); + return Token::make_float (loc, std::move (str), suffix_start, CORETYPE_UNKNOWN); } else if (current_char == 'E' || current_char == 'e')
