You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The asm! macro won't error out the duplication error since after the first options, it bubbles up to the first layer.
Here in parse_asm_arg(), when the parser successfully parses clobber_abi or options, it returns to the first layer right away instead of parsing until it have converged to a NON_COMMITTED after all paths have been taken.
token = parser.peek_current_token ();
if (token->get_id () == COMMA && token->get_id () == last_token_id)
{
parser.skip_token ();
break;
}
// Ok after the left paren is good, we better be parsing correctly
// everything in here, which is operand in ABNF
// TODO: Parse clobber abi, eat the identifier named "clobber_abi" if true
if (check_identifier (parser, "clobber_abi"))
{
auto expected = parse_clobber_abi (inline_asm_ctx);
if (expected || expected.error () == COMMITTED)
return expected;
continue;
}
// TODO: Parse options
if (check_identifier (parser, "options"))
{
auto expected = parse_options (inline_asm_ctx);
if (expected || expected.error () == COMMITTED)
return expected;
continue;
}
// Ok after we have check that neither clobber_abi nor options works, the
// only other logical choice is reg_operand
// std::cout << "reg_operand" << std::endl;
// TODO: BUBBLE UP THIS EXPECTED(...)
auto expected = parse_reg_operand (inline_asm_ctx);
if (expected || expected.error () == COMMITTED)
return expected;
To enlighten the second point, another case that might happen is that the parser have exhausted all the path, and since every path returns a NONCOMMITTED error, this means that no tokens have been consumed, and the while loop will keep on looping forever.
For the 2nd case it is advised to add an rust_unreachable() in fixing the parser.
Current implementation of asm! macro will fail to exhaustively parse all of options(), clobber_abis() and register operands.
For example,
In parsing this,
instead of
The asm! macro won't error out the duplication error since after the first
options
, it bubbles up to the first layer.Here in parse_asm_arg(), when the parser successfully parses clobber_abi or options, it returns to the first layer right away instead of parsing until it have converged to a NON_COMMITTED after all paths have been taken.
To enlighten the second point, another case that might happen is that the parser have exhausted all the path, and since every path returns a NONCOMMITTED error, this means that no tokens have been consumed, and the while loop will keep on looping forever.
For the 2nd case it is advised to add an rust_unreachable() in fixing the parser.
The issue is first mentioned in #3053
The text was updated successfully, but these errors were encountered: