Fix segfaults when using PC outside a section

This commit is contained in:
ISSOtm
2020-03-27 11:37:29 +01:00
parent 06fe27c516
commit 84cd9f2db9
8 changed files with 16 additions and 2 deletions

View File

@@ -106,7 +106,10 @@ void rpn_Symbol(struct Expression *expr, char *tzSym)
{
struct sSymbol *sym = sym_FindSymbol(tzSym);
if (!sym || !sym_IsConstant(sym)) {
if (sym == pPCSymbol && !pPCSymbol->pSection) {
yyerror("PC has no value outside a section");
rpn_Number(expr, 0);
} else if (!sym || !sym_IsConstant(sym)) {
rpn_Init(expr);
expr->isSymbol = true;