mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 17:49:27 +02:00
+ avr: overflow checking for abs, together with the other recent abs-related commits, resolves #40694
This commit is contained in:
parent
b00e9543a7
commit
e7716dc05f
@ -40,7 +40,7 @@ unit navrinl;
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
verbose,
|
verbose,globtype,globals,
|
||||||
constexp,
|
constexp,
|
||||||
compinnr,
|
compinnr,
|
||||||
aasmdata,
|
aasmdata,
|
||||||
@ -57,19 +57,23 @@ unit navrinl;
|
|||||||
var
|
var
|
||||||
hl: TAsmLabel;
|
hl: TAsmLabel;
|
||||||
size: TCgSize;
|
size: TCgSize;
|
||||||
|
dummyloc: tlocation;
|
||||||
begin
|
begin
|
||||||
secondpass(left);
|
secondpass(left);
|
||||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
|
||||||
|
|
||||||
location:=left.location;
|
location:=left.location;
|
||||||
location.register:=hlcg.getintregister(current_asmdata.CurrAsmList,left.resultdef);
|
location.register:=hlcg.getintregister(current_asmdata.CurrAsmList,resultdef);
|
||||||
|
|
||||||
size:=def_cgsize(left.resultdef);
|
size:=def_cgsize(resultdef);
|
||||||
|
|
||||||
current_asmdata.getjumplabel(hl);
|
current_asmdata.getjumplabel(hl);
|
||||||
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,size,OC_GTE,0,left.location.register,hl);
|
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,size,OC_GTE,0,left.location.register,hl);
|
||||||
cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NEG,size,left.location.register,location.register);
|
cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NEG,size,left.location.register,location.register);
|
||||||
|
|
||||||
|
if cs_check_overflow in current_settings.localswitches then
|
||||||
|
cg.g_overflowcheck(current_asmdata.CurrAsmList,dummyloc,resultdef);
|
||||||
|
|
||||||
cg.a_label(current_asmdata.CurrAsmList,hl);
|
cg.a_label(current_asmdata.CurrAsmList,hl);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user