For PIC18 instructions using INSN_CLASS_OPWFA8, gpasm handles symbolic destination operands (W / F) correctly, but numeric destination operands (0 / 1) update insn_flags.bank instead of insn_flags.dest.
As a result, with strict level 2, valid instructions such as:
processor 18f452
radix hex
movf 0x20, 0, 0
incf 0x20, 1, 0
infsnz 0x20, 1, 0
end
are incorrectly rejected with:
Error[1502] destination not selected
The generated instruction encoding itself is not changed by this fix; the problem is the internal destination-selection bookkeeping used by diagnostics and strict checking.
The fix is a one-line change in gpasm/directive.c:
A regression test is included and is run with -S 2, since the bug is exposed at strict level 2.
Tested against a clean gputils r1333 working copy. The full gpasm regression suite passes after the change.
Anonymous