Last active
February 8, 2024 16:23
-
-
Save tommie/3107274f9c3625d6be9c55005a171300 to your computer and use it in GitHub Desktop.
MPASM (gpasm?) macro text substitution flaw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; gpasm --mpasm-compatible -p p16f887 repro.asm | |
;; | |
;; Should produce four nop, but produces none, because the m2 i | |
;; binding leaks into the m1 i via the n parameter. | |
;; | |
;; See also https://forum.microchip.com/s/topic/a5C3l000000LzjcEAC/t229040 | |
m1 macro n | |
local i | |
i set 0 | |
while i < n | |
i set i + 1 | |
nop | |
endw | |
endm | |
m2 macro | |
local i | |
i set 4 | |
m1 i | |
endm | |
m2 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment