I don't yet have a reliable repro of this, but I've found a case where seemingly unrelated changes cause a jmp to miscalculate the address of a label, and fall 27 words short. I have a structure as follows:
The reset vector has a jmp in it to the main label.
Shortly after I have a lengthy OC1B handler.
Then is the main label, which immediately expands a macro which loads 0 into R16.
I found after making some unrelated changes much further down, that the program suddenly wouldn't start. I ran the hex through disassembly both before and after the changes, and the only changes seem to be the ones I'm expecting near the end and that the reset vector is jmping to different address. That address is 27 words early so at startup it's ending up in the middle of an interrupt handler instead of the setup logic.
Disassembly in Atmel Studio; RETI marks the end of the interrupt (where the main label is), CLT is where the reset vector is jmping to:
Diffing the disassemblies of the working and non-working code; you can see that the reset vector at the very top is the only difference until much later on in the file:
I don't yet have a reliable repro of this, but I've found a case where seemingly unrelated changes cause a jmp to miscalculate the address of a label, and fall 27 words short. I have a structure as follows:
main
label.main
label, which immediately expands a macro which loads 0 into R16.I found after making some unrelated changes much further down, that the program suddenly wouldn't start. I ran the hex through disassembly both before and after the changes, and the only changes seem to be the ones I'm expecting near the end and that the reset vector is jmping to different address. That address is 27 words early so at startup it's ending up in the middle of an interrupt handler instead of the setup logic.
Disassembly in Atmel Studio; RETI marks the end of the interrupt (where the![image](https://user-images.githubusercontent.com/3138458/114302342-93dc0380-9ac0-11eb-8090-6f925ecd8786.png)
main
label is), CLT is where the reset vector is jmping to:Diffing the disassemblies of the working and non-working code; you can see that the reset vector at the very top is the only difference until much later on in the file:![image](https://user-images.githubusercontent.com/3138458/114302432-e74e5180-9ac0-11eb-9bde-b30e23449568.png)
I'm going to be investigating this.