* type casting could force pointers into sub registers, so handle them when converting the pointer to an array

git-svn-id: trunk@23591 -
This commit is contained in:
florian 2013-02-10 20:50:12 +00:00
parent 64ad892b55
commit 5a81601565
3 changed files with 57 additions and 3 deletions

1
.gitattributes vendored
View File

@ -9785,6 +9785,7 @@ tests/tbs/tb0589.pp svneol=native#text/pascal
tests/tbs/tb0590.pp svneol=native#text/pascal
tests/tbs/tb0591.pp svneol=native#text/pascal
tests/tbs/tb0592.pp svneol=native#text/plain
tests/tbs/tb0593.pp svneol=native#text/pascal
tests/tbs/tb205.pp svneol=native#text/plain
tests/tbs/ub0060.pp svneol=native#text/plain
tests/tbs/ub0069.pp svneol=native#text/plain

View File

@ -349,12 +349,18 @@ interface
location.reference.base := left.location.register;
end;
LOC_REFERENCE,
LOC_CREFERENCE :
LOC_CREFERENCE,
{ tricky type casting of parameters can cause these locations, see tb0593.pp on x86_64-linux }
LOC_SUBSETREG,
LOC_CSUBSETREG,
LOC_SUBSETREF,
LOC_CSUBSETREF:
begin
location.reference.base:=cg.getaddressregister(current_asmdata.CurrAsmList);
cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.reference,
hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,left.resultdef,left.resultdef,left.location,
location.reference.base);
location_freetemp(current_asmdata.CurrAsmList,left.location);
if left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
location_freetemp(current_asmdata.CurrAsmList,left.location);
end;
else
internalerror(2002032216);

47
tests/tbs/tb0593.pp Normal file
View File

@ -0,0 +1,47 @@
{$mode objfpc}
type
TBlockType = (
btNone,
btBegin,
btAsm,
btEdgedBracket,
btRoundBracket,
btTry,
btFinally,
btExcept,
btCase,
btCaseOf,
btCaseColon,
btCaseElse,
btRepeat,
btIf,
btIfElse,
btClass,
btInterface,
btObject,
btRecord
);
TBlock = record
Typ: TBlockType;
StartPos: integer;
InnerIndent: integer;
InnerStartPos: integer;
end;
PBlock = ^TBlock;
TBlockStack = record
Stack: PBlock;
Capacity: integer;
Top: integer;
end;
function TopBlockType(const Stack: TBlockStack): TBlockType;
begin
if Stack.Top>=0 then
Result:=Stack.Stack[Stack.Top].Typ
else
Result:=btNone;
end;
begin
end.