* correctly handle LOC_SUBSETREG,LOC_CSUBSETREG,LOC_SUBSETREF,LOC_CSUBSETREF in second_int_to_bool, resolves issue #28007

git-svn-id: trunk@30765 -
This commit is contained in:
florian 2015-05-02 13:52:50 +00:00
parent 8ee9550d22
commit b222d0b663
8 changed files with 71 additions and 17 deletions

1
.gitattributes vendored
View File

@ -14417,6 +14417,7 @@ tests/webtbs/tw2788.pp svneol=native#text/plain
tests/webtbs/tw27880.pp svneol=native#text/plain
tests/webtbs/tw2789.pp svneol=native#text/plain
tests/webtbs/tw2794.pp svneol=native#text/plain
tests/webtbs/tw28007.pp svneol=native#text/pascal
tests/webtbs/tw2803.pp svneol=native#text/plain
tests/webtbs/tw2806.pp svneol=native#text/plain
tests/webtbs/tw2807.pp svneol=native#text/plain

View File

@ -163,6 +163,10 @@ implementation
exit;
case left.location.loc of
LOC_SUBSETREG,
LOC_CSUBSETREG,
LOC_SUBSETREF,
LOC_CSUBSETREF,
LOC_CREFERENCE,
LOC_REFERENCE,
LOC_REGISTER,

View File

@ -314,6 +314,10 @@ implementation
{ Load left node into flag F_NE/F_E }
resflags:=F_NE;
if (left.location.loc in [LOC_SUBSETREG,LOC_CSUBSETREG,LOC_SUBSETREF,LOC_CSUBSETREF]) then
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
case left.location.loc of
LOC_CREFERENCE,
LOC_REFERENCE :

View File

@ -199,6 +199,10 @@ implementation
newsize:=def_cgsize(resultdef);
opsize := def_cgsize(left.resultdef);
if (left.location.loc in [LOC_SUBSETREG,LOC_CSUBSETREG,LOC_SUBSETREF,LOC_CSUBSETREF]) then
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
case left.location.loc of
LOC_CREFERENCE,LOC_REFERENCE :
begin

View File

@ -227,6 +227,10 @@ begin
location_reset(location, LOC_REGISTER, def_cgsize(resultdef));
opsize := def_cgsize(left.resultdef);
if (left.location.loc in [LOC_SUBSETREG,LOC_CSUBSETREG,LOC_SUBSETREF,LOC_CSUBSETREF]) then
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
case left.location.loc of
LOC_CREFERENCE, LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER:
begin

View File

@ -110,6 +110,10 @@ implementation
if (opsize in [OS_64,OS_S64]) then
opsize:=OS_32;
{$endif not cpu64bitalu}
if (left.location.loc in [LOC_SUBSETREG,LOC_CSUBSETREG,LOC_SUBSETREF,LOC_CSUBSETREF]) then
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
case left.location.loc of
LOC_CREFERENCE,LOC_REFERENCE,LOC_REGISTER,LOC_CREGISTER :
begin

View File

@ -264,6 +264,10 @@ implementation
location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
opsize:=def_cgsize(left.resultdef);
if (left.location.loc in [LOC_SUBSETREG,LOC_CSUBSETREG,LOC_SUBSETREF,LOC_CSUBSETREF]) then
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
case left.location.loc of
LOC_CREFERENCE,LOC_REFERENCE,LOC_REGISTER,LOC_CREGISTER:
begin

29
tests/webtbs/tw28007.pp Normal file
View File

@ -0,0 +1,29 @@
program error_record;
type
TPackedBool = bitpacked record
b0: Boolean;
b1: Boolean;
b2: Boolean;
b3: Boolean;
b4: Boolean;
b5: Boolean;
b6: Boolean;
b7: Boolean;
end;
var
B: ByteBool;
PackedBool: TPackedBool;
begin
(*
- OK on x86, x86_64 compiler
- ERROR on cross arm compiler
- OK on cross arm compiler if we do typecast:
B := ByteBool(PackedBool.b0);
*)
B := PackedBool.b0;
end.