In the above example, the dummy variable is undefined at the time that the line move.w (dummy).w,d0 is encountered, causing it to be temporarily evaluated to $200000. Since $200000 is not within short addressing range, the assembler throws an error, despite the actual value of the dummy variable being $100, which is within the range.
To fix this, I have made it so that the short addressing range check is not performed if the symbol is undefined. Note that this does not prevent the error from occurring when the true value of the variable is also out-of-range, as the range check is performed again when the line is re-evaluated in a later pass.
This bug could be triggered with the following code:
What happens is that, when an undefined symbol is encountered in the first pass, it is temporarily assigned the value of the program counter.
In the above example, the
dummy
variable is undefined at the time that the linemove.w (dummy).w,d0
is encountered, causing it to be temporarily evaluated to$200000
. Since$200000
is not within short addressing range, the assembler throws an error, despite the actual value of thedummy
variable being$100
, which is within the range.To fix this, I have made it so that the short addressing range check is not performed if the symbol is undefined. Note that this does not prevent the error from occurring when the true value of the variable is also out-of-range, as the range check is performed again when the line is re-evaluated in a later pass.
This fixes the bug that I described in #3.