diff --git a/.gitattributes b/.gitattributes index d80040901b..8d87f042ef 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/ncgbas.pas b/compiler/ncgbas.pas index 23bb631f3f..1643f88164 100644 --- a/compiler/ncgbas.pas +++ b/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); diff --git a/tests/webtbs/tw34409.pp b/tests/webtbs/tw34409.pp new file mode 100644 index 0000000000..2e2a036098 --- /dev/null +++ b/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.