* set the rangedef of open arrays to ptrsinttype (instead of s32inttype),

so that it's the same as the def returned by the low/high nodes
    (mantis #25703)

git-svn-id: trunk@27970 -
This commit is contained in:
Jonas Maebe 2014-06-15 15:26:47 +00:00
parent 5ad478b252
commit 24f4adf657
4 changed files with 22 additions and 3 deletions

1
.gitattributes vendored
View File

@ -13940,6 +13940,7 @@ tests/webtbs/tw25605.pp svneol=native#text/pascal
tests/webtbs/tw2561.pp svneol=native#text/plain
tests/webtbs/tw25610.pp -text svneol=native#text/plain
tests/webtbs/tw25685.pp svneol=native#text/pascal
tests/webtbs/tw25703.pp svneol=native#text/plain
tests/webtbs/tw25781.pp svneol=native#text/plain
tests/webtbs/tw25814.pp svneol=native#text/plain
tests/webtbs/tw25869.pp svneol=native#text/plain

View File

@ -685,10 +685,10 @@ implementation
{ true, if p points to an open array def }
function is_open_array(p : tdef) : boolean;
begin
{ check for s32inttype is needed, because for u32bit the high
{ check for ptrsinttype is needed, because for unsigned the high
range is also -1 ! (PFV) }
result:=(p.typ=arraydef) and
(tarraydef(p).rangedef=s32inttype) and
(tarraydef(p).rangedef=ptrsinttype) and
(tarraydef(p).lowrange=0) and
(tarraydef(p).highrange=-1) and
((tarraydef(p).arrayoptions * [ado_IsVariant,ado_IsArrayOfConst,ado_IsConstructor,ado_IsDynamicArray])=[]);

View File

@ -399,7 +399,7 @@ implementation
consume(_ARRAY);
consume(_OF);
{ define range and type of range }
hdef:=carraydef.create(0,-1,s32inttype);
hdef:=carraydef.create(0,-1,ptrsinttype);
{ array of const ? }
if (token=_CONST) and (m_objpas in current_settings.modeswitches) then
begin

18
tests/webtbs/tw25703.pp Normal file
View File

@ -0,0 +1,18 @@
{ %norun }
{ %opt=-CO -Seh }
{$MODE OBJFPC}
type
TNode = class end;
procedure Test(const Arg: array of TNode);
var
Item: TNode;
begin
for Item in Arg do ; // Warning here
end;
begin
test([]);
end.