Don't consider difference of invalid labels constant

If a label is defined outside of a section, avoid trying to obtain its
value.
This commit is contained in:
Jakub Kądziołka
2020-10-12 13:28:00 +02:00
parent 4419f0d54f
commit 4c5d5c7085
4 changed files with 12 additions and 1 deletions

View File

@@ -307,7 +307,9 @@ bool rpn_IsDiffConstant(struct Expression const *src, struct Symbol const *sym)
if (!sym1 || !sym || sym1->type != SYM_LABEL || sym->type != SYM_LABEL)
return false;
return sym_GetSection(sym1) == sym_GetSection(sym);
struct Section const *section1 = sym_GetSection(sym1);
struct Section const *section2 = sym_GetSection(sym);
return section1 && (section1 == section2);
}
static bool isDiffConstant(struct Expression const *src1,