|
@@ -382,19 +382,23 @@ implementation
|
|
|
{ purposes }
|
|
|
hdenom := cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
|
|
hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,right.resultdef,osuinttype,right.location,hdenom);
|
|
|
- { verify if the divisor is zero, if so return an error
|
|
|
- immediately
|
|
|
+ { verify if the divisor is zero, if so return an error immediately,
|
|
|
+ except if we have a const node, where we don't need this, because
|
|
|
+ then zero check was done earlier.
|
|
|
}
|
|
|
- current_asmdata.getjumplabel(hl);
|
|
|
- cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_NE,0,hdenom,hl);
|
|
|
- paraloc1.init;
|
|
|
- pd:=search_system_proc('fpc_handleerror');
|
|
|
- paramanager.getintparaloc(pd,1,paraloc1);
|
|
|
- cg.a_load_const_cgpara(current_asmdata.CurrAsmList,OS_S32,aint(200),paraloc1);
|
|
|
- paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
|
|
|
- cg.a_call_name(current_asmdata.CurrAsmList,'FPC_HANDLEERROR',false);
|
|
|
- paraloc1.done;
|
|
|
- cg.a_label(current_asmdata.CurrAsmList,hl);
|
|
|
+ if (right.nodetype <> ordconstn) then
|
|
|
+ begin
|
|
|
+ current_asmdata.getjumplabel(hl);
|
|
|
+ cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_NE,0,hdenom,hl);
|
|
|
+ paraloc1.init;
|
|
|
+ pd:=search_system_proc('fpc_handleerror');
|
|
|
+ paramanager.getintparaloc(pd,1,paraloc1);
|
|
|
+ cg.a_load_const_cgpara(current_asmdata.CurrAsmList,OS_S32,aint(200),paraloc1);
|
|
|
+ paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
|
|
|
+ cg.a_call_name(current_asmdata.CurrAsmList,'FPC_HANDLEERROR',false);
|
|
|
+ paraloc1.done;
|
|
|
+ cg.a_label(current_asmdata.CurrAsmList,hl);
|
|
|
+ end;
|
|
|
if nodetype = modn then
|
|
|
emit_mod_reg_reg(is_signed(left.resultdef),hdenom,hreg1)
|
|
|
else
|