* patch by Christo Crause: prevent that the compiler converts breq into jmp in inline assembler blocks, resolves #32949

git-svn-id: trunk@38088 -
This commit is contained in:
florian 2018-01-31 18:34:42 +00:00
parent d580402916
commit 0662b611ca
3 changed files with 28 additions and 6 deletions

1
.gitattributes vendored
View File

@ -14335,6 +14335,7 @@ tests/webtbf/tw3267.pp svneol=native#text/plain
tests/webtbf/tw3275.pp svneol=native#text/plain
tests/webtbf/tw32906.pp svneol=native#text/plain
tests/webtbf/tw3294.pp svneol=native#text/plain
tests/webtbf/tw32949.pp svneol=native#text/pascal
tests/webtbf/tw3331.pp svneol=native#text/plain
tests/webtbf/tw3337.pp svneol=native#text/plain
tests/webtbf/tw3342.pp svneol=native#text/plain

View File

@ -448,12 +448,17 @@ implementation
if (taicpu(curtai).InsOffset-taicpu(curtai).oper[0]^.ref^.symbol.offset>64) or
(taicpu(curtai).InsOffset-taicpu(curtai).oper[0]^.ref^.symbol.offset<-63) then
begin
current_asmdata.getjumplabel(l);
list.insertafter(tai_label.create(l),curtai);
list.insertafter(taicpu.op_sym(A_JMP,taicpu(curtai).oper[0]^.ref^.symbol),curtai);
taicpu(curtai).oper[0]^.ref^.symbol:=l;
taicpu(curtai).condition:=inverse_cond(taicpu(curtai).condition);
again:=true;
if inasmblock then
Message(asmw_e_short_jmp_out_of_range)
else
begin
current_asmdata.getjumplabel(l);
list.insertafter(tai_label.create(l),curtai);
list.insertafter(taicpu.op_sym(A_JMP,taicpu(curtai).oper[0]^.ref^.symbol),curtai);
taicpu(curtai).oper[0]^.ref^.symbol:=l;
taicpu(curtai).condition:=inverse_cond(taicpu(curtai).condition);
again:=true;
end;
end;
A_JMP:
{ replace JMP by RJMP? ...

16
tests/webtbf/tw32949.pp Normal file
View File

@ -0,0 +1,16 @@
{ %CPU=avr }
{ %fail }
{$goto on}
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.