[lld] [LLD] Fix crash on parsing ':ALIGN' in linker script (PR #146723)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 3 09:30:25 PDT 2025
================
@@ -1229,6 +1229,9 @@ SymbolAssignment *ScriptParser::readSymbolAssignment(StringRef name) {
// This is an operator-precedence parser to parse a linker
// script expression.
Expr ScriptParser::readExpr() {
+ // Do not try to read expression if an error has already been encountered.
+ if (atEOF())
----------------
MaskRay wrote:
This looks ok to me as well. A few parser functions call `atEOF()` at the beginning, when they expect to consume at least one token.
https://github.com/llvm/llvm-project/pull/146723
More information about the llvm-commits
mailing list