Browse Source

* adapt register if the size of the paraloc and the register differ, resolves #34409

git-svn-id: trunk@43617 -
florian 5 years ago
parent
commit
f2a8b8ad6a
3 changed files with 21 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 7 1
      compiler/ncgbas.pas
  3. 13 0
      tests/webtbs/tw34409.pp

+ 1 - 0
.gitattributes

@@ -17783,6 +17783,7 @@ tests/webtbs/tw3435.pp svneol=native#text/plain
 tests/webtbs/tw34380.pp svneol=native#text/plain
 tests/webtbs/tw34385.pp svneol=native#text/plain
 tests/webtbs/tw34385a.pp svneol=native#text/plain
+tests/webtbs/tw34409.pp svneol=native#text/pascal
 tests/webtbs/tw3441.pp svneol=native#text/plain
 tests/webtbs/tw3443.pp svneol=native#text/plain
 tests/webtbs/tw34438.pp svneol=native#text/pascal

+ 7 - 1
compiler/ncgbas.pas

@@ -84,6 +84,9 @@ interface
       procinfo,
       cpuinfo,
       tgobj
+{$ifdef x86}
+      ,cgx86
+{$endif x86}
       ;
 
 {*****************************************************************************
@@ -215,7 +218,10 @@ interface
                     begin
                       op.typ:=top_reg;
                       op.reg:=sym.localloc.register;
-
+{$ifdef x86}
+                      if reg2opsize(op.reg)<>TCGSize2Opsize[sym.localloc.size] then
+                        op.reg:=newreg(getregtype(op.reg),getsupreg(op.reg),cgsize2subreg(getregtype(op.reg),sym.localloc.size));
+{$endif x86}
 {$ifdef avr}
                       case sofs of
                         1: op.reg:=cg.GetNextReg(op.reg);

+ 13 - 0
tests/webtbs/tw34409.pp

@@ -0,0 +1,13 @@
+{ %cpu=i386,x86_64 }
+{ %norun }
+{ %opt=-Rintel -O4 -a }
+
+function foo ( w : word):byte; assembler;
+asm
+     mov ax, w
+
+end;
+
+begin
+     foo(3);
+end.