* fix compilation of Rtti unit on PowerPC: converting a Int64 to a Boolean failed (in this case with an internal error)

+ added a test though we should probably extend tcnvint2.pp to test converting ints to different sized boolean types...

git-svn-id: trunk@35101 -
This commit is contained in:
svenbarth 2016-12-10 19:13:07 +00:00
parent 02e2b8752d
commit 0c372f0beb
3 changed files with 49 additions and 1 deletions

1
.gitattributes vendored
View File

@ -11060,6 +11060,7 @@ tests/tbs/tb0621.pp svneol=native#text/plain
tests/tbs/tb0622.pp svneol=native#text/plain
tests/tbs/tb0623.pp svneol=native#text/pascal
tests/tbs/tb0624.pp svneol=native#text/pascal
tests/tbs/tb0625.pp svneol=native#text/pascal
tests/tbs/tb205.pp svneol=native#text/plain
tests/tbs/tb610.pp svneol=native#text/pascal
tests/tbs/tb613.pp svneol=native#text/plain

View File

@ -72,6 +72,7 @@ implementation
hreg2 : tregister;
{$ifndef cpu64bitalu}
href : treference;
oldloc : tlocation;
{$endif not cpu64bitalu}
resflags : tresflags;
opsize : tcgsize;
@ -92,7 +93,30 @@ implementation
{ change of size? change sign only if location is LOC_(C)REGISTER? Then we have to sign/zero-extend }
if (tcgsize2size[newsize]<>tcgsize2size[left.location.size]) or
((newsize<>left.location.size) and (location.loc in [LOC_REGISTER,LOC_CREGISTER])) then
hlcg.location_force_reg(current_asmdata.CurrAsmList,location,left.resultdef,resultdef,true)
begin
{$ifndef cpu64bitalu}
if (left.location.size in [OS_64,OS_S64]) and (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
begin
hreg1:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,left.location.reference,hreg1);
hreg2:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
href:=left.location.reference;
inc(href.offset,4);
cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,href,hreg2);
cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,hreg1,hreg2,hreg1);
if left.location.loc<>LOC_CREGISTER then
location_reset(location,LOC_REGISTER,def_cgsize(resultdef))
else
location_reset(location,LOC_CREGISTER,def_cgsize(resultdef));
location.register:=hreg1;
{ Release temp if it was a reference }
if left.location.loc=LOC_REFERENCE then
location_freetemp(current_asmdata.CurrAsmList,left.location);
end
else
{$endif not cpu64bitalu}
hlcg.location_force_reg(current_asmdata.CurrAsmList,location,left.resultdef,resultdef,true)
end
else
location.size:=newsize;
exit;

23
tests/tbs/tb0625.pp Normal file
View File

@ -0,0 +1,23 @@
program tb0625;
var
i: Int64;
b: Boolean;
begin
i := 1;
b := Boolean(i);
if not b then
Halt(1);
i := 0;
b := Boolean(i);
if b then
Halt(2);
i := 42;
b := Boolean(i);
if not b then
Halt(3);
i := $ffffffffffffffff;
b := Boolean(i);
if not b then
Halt(4);
end.