From 3d3298f64dea270166169c655e6fa9d0480c2399 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 7 Oct 2017 21:09:20 +0000 Subject: [PATCH] * write absolute references correctly on avr, resolves #32040 git-svn-id: trunk@37419 - --- .gitattributes | 1 + compiler/avr/agavrgas.pas | 4 +++- tests/webtbs/tw32040.pp | 40 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tests/webtbs/tw32040.pp diff --git a/.gitattributes b/.gitattributes index fc26659d4e..cb3d7753af 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15786,6 +15786,7 @@ tests/webtbs/tw3185.pp svneol=native#text/plain tests/webtbs/tw3190.pp svneol=native#text/plain tests/webtbs/tw31945.pp svneol=native#text/pascal tests/webtbs/tw3197.pp svneol=native#text/plain +tests/webtbs/tw32040.pp svneol=native#text/pascal tests/webtbs/tw32043.pp svneol=native#text/pascal tests/webtbs/tw3207.pp svneol=native#text/plain tests/webtbs/tw3210.pp svneol=native#text/plain diff --git a/compiler/avr/agavrgas.pas b/compiler/avr/agavrgas.pas index e9264f9535..cab115428a 100644 --- a/compiler/avr/agavrgas.pas +++ b/compiler/avr/agavrgas.pas @@ -119,7 +119,9 @@ unit agavrgas; if assigned(symbol) then s:=ReplaceForbiddenAsmSymbolChars(symbol.name); - if offset<0 then + if s='' then + s:=tostr(offset) + else if offset<0 then s:=s+tostr(offset) else if offset>0 then s:=s+'+'+tostr(offset); diff --git a/tests/webtbs/tw32040.pp b/tests/webtbs/tw32040.pp new file mode 100644 index 0000000000..f851a2fbd8 --- /dev/null +++ b/tests/webtbs/tw32040.pp @@ -0,0 +1,40 @@ +{ %cpu=avr } +{ %norun } +const + c0 = 0; + c1 = 1; + c2 = $02; + c10 = $10; + c22 = $22; + c100 = $100; + c1000 = $1000; + c3070 = $3070; + +procedure something; assembler; nostackframe; +asm + ldi ZL, lo8(c0); + ldi ZH, hi8(c0); + ldi ZL, lo8(c1); + ldi ZH, hi8(c1); + ldi ZL, lo8(c2); + ldi ZH, hi8(c2); + ldi ZL, lo8(c10); + ldi ZH, hi8(c10); + ldi ZL, lo8(c22); + ldi ZH, hi8(c22); + ldi ZL, lo8(c100); + ldi ZH, hi8(c100); + ldi ZL, lo8(c1000); + ldi ZH, hi8(c1000); + ldi ZL, lo8(c3070); + ldi ZH, hi8(c3070); + + ldi ZL, lo8(0x3070); + ldi ZH, hi8(0x3070); + ldi ZL, lo8(0x300); + ldi ZH, hi8(0x300); +end; + + +begin +end.