* Fixed IE201103063 when <dynamic array of unmanaged type> is being passed to <out open array> parameter.

git-svn-id: trunk@19684 -
This commit is contained in:
sergei 2011-11-25 14:43:17 +00:00
parent dce13ae068
commit 3a579ced7b
3 changed files with 29 additions and 5 deletions

1
.gitattributes vendored
View File

@ -9766,6 +9766,7 @@ tests/test/talign2.pp svneol=native#text/plain
tests/test/targ1a.pp svneol=native#text/plain
tests/test/targ1b.pp svneol=native#text/plain
tests/test/tarray1.pp svneol=native#text/plain
tests/test/tarray10.pp svneol=native#text/plain
tests/test/tarray2.pp svneol=native#text/plain
tests/test/tarray3.pp svneol=native#text/plain
tests/test/tarray4.pp svneol=native#text/plain

View File

@ -169,11 +169,16 @@ implementation
location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false,sizeof(pint));
if is_open_array(resultdef) then
begin
if third=nil then
InternalError(201103063);
secondpass(third);
cg.g_array_rtti_helper(current_asmdata.CurrAsmList,tarraydef(resultdef).elementdef,
href,third.location,'FPC_DECREF_ARRAY');
{ if elementdef is not managed, omit fpc_decref_array
because it won't do anything anyway }
if is_managed_type(tarraydef(resultdef).elementdef) then
begin
if third=nil then
InternalError(201103063);
secondpass(third);
cg.g_array_rtti_helper(current_asmdata.CurrAsmList,tarraydef(resultdef).elementdef,
href,third.location,'FPC_DECREF_ARRAY');
end;
end
else
cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);

18
tests/test/tarray10.pp Normal file
View File

@ -0,0 +1,18 @@
{$mode objfpc}{$h+}
procedure SetArray(out SingleArray: array of Single; const Value: Single);
var
I: Integer;
begin
for I := Low(SingleArray) to High(SingleArray) do
SingleArray[I] := Value;
end;
var
ValuesBuffer: array of Single;
begin
SetLength(ValuesBuffer, 5);
{ passing <dynamic array of unmanaged type> to <out open array> should not trigger IE 201103063 }
SetArray(ValuesBuffer, 5.7);
end.