diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2021-04-19 20:52:46 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2021-04-19 20:52:46 +0000 |
commit | 37e64ce170ecf9ba382e00b2a29dc5f367777e53 (patch) | |
tree | ffade047bdfbe406718d43d709500b33608b8dd9 | |
parent | c997613f43aa017d34666ea5b0e09a9163b868e0 (diff) | |
download | fpc-37e64ce170ecf9ba382e00b2a29dc5f367777e53.tar.gz |
--- Merging r49236 into '.':
U compiler/aarch64/hlcgcpu.pas
A tests/webtbs/tw38766.pp
--- Recording mergeinfo for merge of r49236 into '.':
U .
git-svn-id: https://svn.freepascal.org/svn/fpc/branches/fixes_3_2@49237 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | compiler/aarch64/hlcgcpu.pas | 3 | ||||
-rw-r--r-- | tests/webtbs/tw38766.pp | 28 |
2 files changed, 30 insertions, 1 deletions
diff --git a/compiler/aarch64/hlcgcpu.pas b/compiler/aarch64/hlcgcpu.pas index 4fe1e342be..54a94f58fc 100644 --- a/compiler/aarch64/hlcgcpu.pas +++ b/compiler/aarch64/hlcgcpu.pas @@ -212,7 +212,8 @@ implementation if slopt in [SL_SETZERO,SL_SETMAX] then inherited else if not(sreg.bitlen in [32,64]) or - (sreg.startbit<>0) then + (sreg.startbit<>0) or + (getsubreg(fromreg)<getsubreg(sreg.subsetreg)) then begin makeregssamesize(list,def_cgsize(fromsize),sreg.subsetregsize,fromreg,sreg.subsetreg,fromreg,toreg); list.concat(taicpu.op_reg_reg_const_const(A_BFI,toreg,fromreg,sreg.startbit,sreg.bitlen)) diff --git a/tests/webtbs/tw38766.pp b/tests/webtbs/tw38766.pp new file mode 100644 index 0000000000..7393d00f91 --- /dev/null +++ b/tests/webtbs/tw38766.pp @@ -0,0 +1,28 @@ +{$mode objfpc} + +type + trec = record + x, y: longint; + end; + +function max(x,y: longint): longint; +begin + if x>y then + result:=x + else + result:=y; +end; + +function test: trec; inline; +begin + result.x:=1; + result.y:=2; + result.x:=max(result.x,result.y); +end; + +begin + if test.x<>2 then + halt(1); + if test.y<>2 then + halt(2); +end. |