mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 10:09:19 +02:00
Avoid range check error in a_op_const_reg_reg
git-svn-id: trunk@27060 -
This commit is contained in:
parent
fb218fa671
commit
044891fd94
@ -1554,7 +1554,7 @@ unit cgx86;
|
|||||||
procedure tcgx86.a_op_const_reg_reg(list:TAsmList;op:Topcg;size:Tcgsize;
|
procedure tcgx86.a_op_const_reg_reg(list:TAsmList;op:Topcg;size:Tcgsize;
|
||||||
a:tcgint;src,dst:Tregister);
|
a:tcgint;src,dst:Tregister);
|
||||||
var
|
var
|
||||||
power : longint;
|
power,al : longint;
|
||||||
href : treference;
|
href : treference;
|
||||||
begin
|
begin
|
||||||
power:=0;
|
power:=0;
|
||||||
@ -1592,7 +1592,13 @@ unit cgx86;
|
|||||||
) and
|
) and
|
||||||
not(cs_check_overflow in current_settings.localswitches) then
|
not(cs_check_overflow in current_settings.localswitches) then
|
||||||
begin
|
begin
|
||||||
reference_reset_base(href,src,a,0);
|
{ a might still be in the range 0x80000000 to 0xffffffff
|
||||||
|
which might trigger a range check error as
|
||||||
|
reference_reset_base expects a longint value. }
|
||||||
|
{$push} {$R-}{$Q-}
|
||||||
|
al := longint (a);
|
||||||
|
{$pop}
|
||||||
|
reference_reset_base(href,src,al,0);
|
||||||
list.concat(taicpu.op_ref_reg(A_LEA,TCgSize2OpSize[size],href,dst));
|
list.concat(taicpu.op_ref_reg(A_LEA,TCgSize2OpSize[size],href,dst));
|
||||||
end
|
end
|
||||||
else if (op=OP_SUB) and
|
else if (op=OP_SUB) and
|
||||||
|
Loading…
Reference in New Issue
Block a user