* handle int_to_bool for qwordbools correctly on arm

git-svn-id: trunk@19933 -
This commit is contained in:
florian 2011-12-31 14:14:21 +00:00
parent 659b386f02
commit 862f9dacea
2 changed files with 30 additions and 8 deletions

View File

@ -215,6 +215,7 @@ implementation
procedure tarmtypeconvnode.second_int_to_bool; procedure tarmtypeconvnode.second_int_to_bool;
var var
hreg1,
hregister : tregister; hregister : tregister;
href : treference; href : treference;
resflags : tresflags; resflags : tresflags;
@ -311,10 +312,27 @@ implementation
end; end;
{ load flags to register } { load flags to register }
location_reset(location,LOC_REGISTER,def_cgsize(resultdef)); location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size); hreg1:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
cg.g_flags2reg(current_asmdata.CurrAsmList,location.size,resflags,location.register); cg.g_flags2reg(current_asmdata.CurrAsmList,location.size,resflags,hreg1);
if (is_cbool(resultdef)) then if (is_cbool(resultdef)) then
cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NEG,location.size,location.register,location.register); cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NEG,location.size,hreg1,hreg1);
{$ifndef cpu64bitalu}
if (location.size in [OS_64,OS_S64]) then
begin
location.register64.reglo:=hreg1;
location.register64.reghi:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
if (is_cbool(resultdef)) then
{ reglo is either 0 or -1 -> reghi has to become the same }
cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_32,OS_32,location.register64.reglo,location.register64.reghi)
else
{ unsigned }
cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,0,location.register64.reghi);
end
else
{$endif cpu64bitalu}
location.register:=hreg1;
current_procinfo.CurrTrueLabel:=oldTrueLabel; current_procinfo.CurrTrueLabel:=oldTrueLabel;
current_procinfo.CurrFalseLabel:=oldFalseLabel; current_procinfo.CurrFalseLabel:=oldFalseLabel;
end; end;

View File

@ -10,10 +10,14 @@ program qwordbool_test_02;
// Sample: // Sample:
// //
function qbool_result(something:integer):qwordbool; function qbool_result(something:integer):qwordbool;
begin qbool_result:=(something<>0); begin
end; qbool_result:=(something<>0);
end;
var test:boolean; var test:boolean;
begin test:=qbool_result(123); //here(17,13) Fatal: Internal error 200410105 begin
writeln(test); test:=qbool_result(123); //here(17,13) Fatal: Internal error 200410105
end. if not(test) then
halt(1);
writeln('ok');
end.