Ro5bert / avra

Assembler for the Atmel AVR microcontroller family
GNU General Public License v2.0
156 stars 40 forks source link

`.if` directive equality checks may be misdocumented and incorrectly fall back to bitwise AND #36

Closed jameswilddev closed 3 years ago

jameswilddev commented 3 years ago

The documentation indicates that you can perform an equality check in an .if directive using the = operator:

.if network = 1
.include "include\tcpip.asm"
.else
.include "include\dummynet.asm"
.endif

This repro, however, raises an error (and the path which raises an error should not be hit):

.equ correct_answer = 10
.equ incorrect_answer = 18

.equ value = correct_answer

.if value = incorrect_answer
    .error "The incorrect answer has been chosen."
.endif

Looking at the source code, it looks as though the correct operator is == and when the second character is not = it instead falls through to bitwise AND.