Add compile time error for undefined labels

This commit is contained in:
drmortalwombat 2024-07-28 14:41:29 +02:00
parent 5bb8ca0b89
commit 1bc5a2ad7e

View File

@ -1091,10 +1091,15 @@ void InterCodeGenerator::TranslateAssembler(InterCodeModule* mod, Expression* ex
if (aexp->mBase->mBase)
disp = aexp->mOffset + aexp->mBase->mInteger - offset - 1;
else
mErrors->Error(aexp->mLocation, EERR_ASM_INVALD_OPERAND, "Undefined immediate operand", aexp->mBase->mQualIdent);
mErrors->Error(aexp->mLocation, EERR_ASM_INVALD_OPERAND, "Undefined label", aexp->mBase->mQualIdent);
}
else
else if (aexp->mType == DT_LABEL)
{
if (aexp->mBase)
disp = aexp->mInteger - offset - 1;
else
mErrors->Error(aexp->mLocation, EERR_ASM_INVALD_OPERAND, "Undefined label", aexp->mQualIdent);
}
if (disp < -128 || disp > 127)
mErrors->Error(aexp->mLocation, EERR_ASM_INVALD_OPERAND, "Branch target out of range");