mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 07:29:18 +02:00
* fixed endless recursion in tabstractrecorddef.contains_float_field() in
case a record contains an internal typed constant of its own type (which happened becuase such a typed constant is also fieldvarsym, solved by checking for sp_static) (mantis #27880) * fixed several other similar cases in the compiler where we are only interested in instance fields, but processed all fieldvarsyms git-svn-id: trunk@30614 -
This commit is contained in:
parent
25a834087e
commit
3be51e1455
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -14394,6 +14394,7 @@ tests/webtbs/tw2780.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw27811.pp svneol=native#text/plain
|
tests/webtbs/tw27811.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw27832.pp svneol=native#text/plain
|
tests/webtbs/tw27832.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2788.pp svneol=native#text/plain
|
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/tw2789.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2794.pp svneol=native#text/plain
|
tests/webtbs/tw2794.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2803.pp svneol=native#text/plain
|
tests/webtbs/tw2803.pp svneol=native#text/plain
|
||||||
|
@ -456,7 +456,8 @@ implementation
|
|||||||
i:=curindex;
|
i:=curindex;
|
||||||
repeat
|
repeat
|
||||||
inc(i);
|
inc(i);
|
||||||
until tsym(tabstractrecorddef(def).symtable.symlist[i]).typ=fieldvarsym;
|
until (tsym(tabstractrecorddef(def).symtable.symlist[i]).typ=fieldvarsym) and
|
||||||
|
not(sp_static in tsym(tabstractrecorddef(def).symtable.symlist[i]).symoptions);
|
||||||
nextoffset:=fieldoffset[i];
|
nextoffset:=fieldoffset[i];
|
||||||
currentoffset:=curoffset;
|
currentoffset:=curoffset;
|
||||||
curindex:=i;
|
curindex:=i;
|
||||||
|
@ -2401,6 +2401,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
sym:=tsym(obj.symtable.symlist[i]);
|
sym:=tsym(obj.symtable.symlist[i]);
|
||||||
if (sym.typ=fieldvarsym) and
|
if (sym.typ=fieldvarsym) and
|
||||||
|
not(sp_static in sym.symoptions) and
|
||||||
(jvmimplicitpointertype(tfieldvarsym(sym).vardef) or
|
(jvmimplicitpointertype(tfieldvarsym(sym).vardef) or
|
||||||
((tfieldvarsym(sym).vardef.typ=enumdef) and
|
((tfieldvarsym(sym).vardef.typ=enumdef) and
|
||||||
get_enum_init_val_ref(tfieldvarsym(sym).vardef,ref))) then
|
get_enum_init_val_ref(tfieldvarsym(sym).vardef,ref))) then
|
||||||
|
@ -594,6 +594,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
sym:=tsym(_class.symtable.SymList[i]);
|
sym:=tsym(_class.symtable.SymList[i]);
|
||||||
if (sym.typ=fieldvarsym) and
|
if (sym.typ=fieldvarsym) and
|
||||||
|
not(sp_static in sym.symoptions) and
|
||||||
(sym.visibility=vis_published) then
|
(sym.visibility=vis_published) then
|
||||||
begin
|
begin
|
||||||
if tfieldvarsym(sym).vardef.typ<>objectdef then
|
if tfieldvarsym(sym).vardef.typ<>objectdef then
|
||||||
@ -659,6 +660,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
sym:=tsym(_class.symtable.SymList[i]);
|
sym:=tsym(_class.symtable.SymList[i]);
|
||||||
if (sym.typ=fieldvarsym) and
|
if (sym.typ=fieldvarsym) and
|
||||||
|
not(sp_static in sym.symoptions) and
|
||||||
(sym.visibility=vis_published) then
|
(sym.visibility=vis_published) then
|
||||||
begin
|
begin
|
||||||
{
|
{
|
||||||
|
@ -165,7 +165,8 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
|||||||
begin
|
begin
|
||||||
result:=tsym(def.symtable.SymList[symidx]);
|
result:=tsym(def.symtable.SymList[symidx]);
|
||||||
inc(symidx);
|
inc(symidx);
|
||||||
if result.typ=fieldvarsym then
|
if (result.typ=fieldvarsym) and
|
||||||
|
not(sp_static in result.symoptions) then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
result:=nil;
|
result:=nil;
|
||||||
|
@ -191,7 +191,8 @@ implementation
|
|||||||
result:=false;
|
result:=false;
|
||||||
for i:=0 to symtable.SymList.Count-1 do
|
for i:=0 to symtable.SymList.Count-1 do
|
||||||
begin
|
begin
|
||||||
if tsym(symtable.symlist[i]).typ=fieldvarsym then
|
if (tsym(symtable.symlist[i]).typ=fieldvarsym) and
|
||||||
|
not(sp_static in tsym(symtable.symlist[i]).symoptions) then
|
||||||
begin
|
begin
|
||||||
checkdef:=tfieldvarsym(symtable.symlist[i]).vardef;
|
checkdef:=tfieldvarsym(symtable.symlist[i]).vardef;
|
||||||
repeat
|
repeat
|
||||||
|
@ -4001,7 +4001,8 @@ implementation
|
|||||||
result:=true;
|
result:=true;
|
||||||
for i:=0 to symtable.symlist.count-1 do
|
for i:=0 to symtable.symlist.count-1 do
|
||||||
begin
|
begin
|
||||||
if tsym(symtable.symlist[i]).typ<>fieldvarsym then
|
if (tsym(symtable.symlist[i]).typ<>fieldvarsym) or
|
||||||
|
(sp_static in tsym(symtable.symlist[i]).symoptions) then
|
||||||
continue;
|
continue;
|
||||||
if assigned(tfieldvarsym(symtable.symlist[i]).vardef) then
|
if assigned(tfieldvarsym(symtable.symlist[i]).vardef) then
|
||||||
begin
|
begin
|
||||||
|
@ -1282,6 +1282,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
sym:=tsym(symlist[i]);
|
sym:=tsym(symlist[i]);
|
||||||
if (sym.typ=fieldvarsym) and
|
if (sym.typ=fieldvarsym) and
|
||||||
|
not(sp_static in sym.symoptions) and
|
||||||
(tfieldvarsym(sym).fieldoffset>=offset) then
|
(tfieldvarsym(sym).fieldoffset>=offset) then
|
||||||
begin
|
begin
|
||||||
result:=tfieldvarsym(sym);
|
result:=tfieldvarsym(sym);
|
||||||
@ -1362,7 +1363,8 @@ implementation
|
|||||||
{ record has one field? }
|
{ record has one field? }
|
||||||
for i:=0 to currentsymlist.Count-1 do
|
for i:=0 to currentsymlist.Count-1 do
|
||||||
begin
|
begin
|
||||||
if tsym(symlist[i]).typ=fieldvarsym then
|
if (tsym(symlist[i]).typ=fieldvarsym) and
|
||||||
|
not(sp_static in tsym(symlist[i]).symoptions) then
|
||||||
begin
|
begin
|
||||||
if result then
|
if result then
|
||||||
begin
|
begin
|
||||||
|
@ -1058,7 +1058,8 @@ Unit Rax86int;
|
|||||||
end;
|
end;
|
||||||
if (actasmtoken=AS_DOT) or
|
if (actasmtoken=AS_DOT) or
|
||||||
(assigned(sym) and
|
(assigned(sym) and
|
||||||
(sym.typ = fieldvarsym)) then
|
(sym.typ = fieldvarsym) and
|
||||||
|
not(sp_static in sym.symoptions)) then
|
||||||
begin
|
begin
|
||||||
BuildRecordOffsetSize(tempstr,l,k,hs,needvmtofs);
|
BuildRecordOffsetSize(tempstr,l,k,hs,needvmtofs);
|
||||||
if hs <> '' then
|
if hs <> '' then
|
||||||
|
16
tests/webtbs/tw27880.pp
Normal file
16
tests/webtbs/tw27880.pp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{ %norun }
|
||||||
|
|
||||||
|
program project1;
|
||||||
|
|
||||||
|
{$mode delphi}
|
||||||
|
|
||||||
|
type
|
||||||
|
TSomeRecord = record
|
||||||
|
Value: Integer;
|
||||||
|
const
|
||||||
|
Invalid: TSomeRecord = (Value: 25);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user