This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Fix parseBareSymbol to not double-parse top-level operators
ClosedPublic

Authored by jrtc27 on Feb 27 2022, 12:00 PM.

Details

Summary

By failing to lex the token we end up both parsing it as a binary
operator ourselves and parsing it as a unary operator when calling
parseExpression on the RHS. For plus this is harmless but for minus this
parses "foo - 4" as "foo - -4", effectively treating a top-level minus
as a plus.

Fixes https://github.com/llvm/llvm-project/issues/54105

Diff Detail

Event Timeline

jrtc27 created this revision.Feb 27 2022, 12:00 PM
jrtc27 requested review of this revision.Feb 27 2022, 12:00 PM
MaskRay accepted this revision.Feb 27 2022, 12:21 PM

Looks great!

llvm/test/MC/RISCV/rvi-pseudos.s
191

End a full sentence with a period.

This revision is now accepted and ready to land.Feb 27 2022, 12:21 PM
asb accepted this revision.Feb 27 2022, 12:31 PM

Thanks for the fix! LGTM.

This revision was landed with ongoing or failed builds.Feb 27 2022, 12:49 PM
This revision was automatically updated to reflect the committed changes.
jrtc27 marked an inline comment as done.Feb 27 2022, 12:49 PM