AVR - BREQ instruction in asm block modified by compiler
Original Reporter info from Mantis: ccrause @ccrause
-
Reporter name: Christo Crause
Original Reporter info from Mantis: ccrause @ccrause
- Reporter name: Christo Crause
Description:
The compiler changes branch instructions when the branch distance exceeds the allowed range in finaliseavrcode procedure in aasmcpu.pas. This should not be allowed when the code is inside an asm block.
The attached patch first checks whether the generated BRxx instruction is from inside an asm block before changing the BRxx instruction to the jmp equivalent. I've added an error message when inside an asm block.
Steps to reproduce:
Compile following code and inspect generated instructions:
program test;
label lbl;
begin
asm
lbl:
nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;
nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;
nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;
nop; nop; nop;
breq lbl
end;
end.
The breq part of the code gets transformed as follows currently:
# [13] breq lbl brne .Lj4 .Ll7: # [15] end. jmp .Lj3
.Lj4:
Mantis conversion info:
- Mantis ID: 32949
- Build: r37889
- Version: 3.1.1
- Fixed in version: 3.1.1
- Fixed in revision: 38088 (#0662b611)