Kingcom / armips

An assembler for various ARM and MIPS platforms. Builds available at http://buildbot.orphis.net/armips/
MIT License
363 stars 77 forks source link

readu32() etc evaluated in false block #105

Closed Prof9 closed 7 years ago

Prof9 commented 7 years ago

Given the following input .asm and an empty test.bin file:

.if 0x12345678 < filesize("test.bin")
    .notice tohex(readu32("test.bin", 0x12345678))
.endif

Produces test.asm(2) error: Invalid expression due to the readu32 offset 0x12345678 being greater than the file size. However, nothing should happen since the readu32() occurs in a false block.

However, if a readu32() in a false block is passed an undefined label as the filename, then it does work. The following compiles without errors:

.if 0
.notice tohex(readu32(undefinedlabel))
.endif

By the way, the error message for a non-existant file doesn't print correctly. .notice tohex(readu32("doesntexist.bin")) produces test.asm(1) error: Could not open 00D22220 where 00D22220 is a random memory address.

Using 91ad61a. Probably similar to #83.

Prof9 commented 7 years ago

Thanks for the quick fix!