Browse Source

* avr: correctly write references to nil, resolves #32821

git-svn-id: trunk@37838 -
florian 7 years ago
parent
commit
0f51cf8546
3 changed files with 13 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 4 1
      compiler/avr/agavrgas.pas
  3. 8 0
      tests/webtbs/tw32821.pp

+ 1 - 0
.gitattributes

@@ -15916,6 +15916,7 @@ tests/webtbs/tw3272b.pp svneol=native#text/pascal
 tests/webtbs/tw3274.pp svneol=native#text/plain
 tests/webtbs/tw3274.pp svneol=native#text/plain
 tests/webtbs/tw3280.pp svneol=native#text/plain
 tests/webtbs/tw3280.pp svneol=native#text/plain
 tests/webtbs/tw3281.pp svneol=native#text/plain
 tests/webtbs/tw3281.pp svneol=native#text/plain
+tests/webtbs/tw32821.pp svneol=native#text/pascal
 tests/webtbs/tw3286.pp svneol=native#text/plain
 tests/webtbs/tw3286.pp svneol=native#text/plain
 tests/webtbs/tw3292.pp svneol=native#text/plain
 tests/webtbs/tw3292.pp svneol=native#text/plain
 tests/webtbs/tw3294a.pp svneol=native#text/plain
 tests/webtbs/tw3294a.pp svneol=native#text/plain

+ 4 - 1
compiler/avr/agavrgas.pas

@@ -137,7 +137,10 @@ unit agavrgas;
                     else
                     else
                       s:='('+s+')';
                       s:='('+s+')';
                   end;
                   end;
-                end;
+                end
+              { reference to address 0? }
+              else if not(assigned(symbol)) and (offset=0) then
+                s:='(0)';
             end;
             end;
           getreferencestring:=s;
           getreferencestring:=s;
         end;
         end;

+ 8 - 0
tests/webtbs/tw32821.pp

@@ -0,0 +1,8 @@
+{ %cpu=avr }
+program test;
+var
+  r0: byte absolute 0;
+begin
+  r0 := 128;
+end.
+