Vladikcomper discovered this issue in the SSRG Discord server:
Today I was once again convinced that AS is a complete garbage of an assembler.
See? AS thinks clear as day that StartOffset>EndOffset. This is why I never use it in real projects.
This bug also exists in smsp2asm macros current AS disassemblies use and people were complaining that installing a few things (like Mega PCM 2) may break compilation out of blue
For anyone interested: this bug occurs because AS retains EndOffset value from the previous pass.
On the first pass, AS evaluates bra as bra.s, so they take 4 bytes and StartOffset = 4, EndOffset = 6
On the second pass, AS realizes bra should be bra.w, because label in bra Return is a bit far away (>256 bytes). Instructions take 8 bytes now, so StartOffset = 8 now, but EndOffset = 6, it still wasn't updated from the previous pass by the time check is executed.
This is just way too broken. Think about how many comparisons can yield incorrect results. How in the world is AS even usable. It shouldn't allow to resolve forward references from the previous pass in the first place.
Vladikcomper discovered this issue in the SSRG Discord server: