mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 01:39:27 +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/tw27832.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/tw2794.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2803.pp svneol=native#text/plain
|
||||
|
@ -456,7 +456,8 @@ implementation
|
||||
i:=curindex;
|
||||
repeat
|
||||
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];
|
||||
currentoffset:=curoffset;
|
||||
curindex:=i;
|
||||
|
@ -2401,6 +2401,7 @@ implementation
|
||||
begin
|
||||
sym:=tsym(obj.symtable.symlist[i]);
|
||||
if (sym.typ=fieldvarsym) and
|
||||
not(sp_static in sym.symoptions) and
|
||||
(jvmimplicitpointertype(tfieldvarsym(sym).vardef) or
|
||||
((tfieldvarsym(sym).vardef.typ=enumdef) and
|
||||
get_enum_init_val_ref(tfieldvarsym(sym).vardef,ref))) then
|
||||
|
@ -594,6 +594,7 @@ implementation
|
||||
begin
|
||||
sym:=tsym(_class.symtable.SymList[i]);
|
||||
if (sym.typ=fieldvarsym) and
|
||||
not(sp_static in sym.symoptions) and
|
||||
(sym.visibility=vis_published) then
|
||||
begin
|
||||
if tfieldvarsym(sym).vardef.typ<>objectdef then
|
||||
@ -659,6 +660,7 @@ implementation
|
||||
begin
|
||||
sym:=tsym(_class.symtable.SymList[i]);
|
||||
if (sym.typ=fieldvarsym) and
|
||||
not(sp_static in sym.symoptions) and
|
||||
(sym.visibility=vis_published) then
|
||||
begin
|
||||
{
|
||||
|
@ -165,7 +165,8 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
||||
begin
|
||||
result:=tsym(def.symtable.SymList[symidx]);
|
||||
inc(symidx);
|
||||
if result.typ=fieldvarsym then
|
||||
if (result.typ=fieldvarsym) and
|
||||
not(sp_static in result.symoptions) then
|
||||
exit;
|
||||
end;
|
||||
result:=nil;
|
||||
|
@ -191,7 +191,8 @@ implementation
|
||||
result:=false;
|
||||
for i:=0 to symtable.SymList.Count-1 do
|
||||
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
|
||||
checkdef:=tfieldvarsym(symtable.symlist[i]).vardef;
|
||||
repeat
|
||||
|
@ -4001,7 +4001,8 @@ implementation
|
||||
result:=true;
|
||||
for i:=0 to symtable.symlist.count-1 do
|
||||
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;
|
||||
if assigned(tfieldvarsym(symtable.symlist[i]).vardef) then
|
||||
begin
|
||||
|
@ -1282,6 +1282,7 @@ implementation
|
||||
begin
|
||||
sym:=tsym(symlist[i]);
|
||||
if (sym.typ=fieldvarsym) and
|
||||
not(sp_static in sym.symoptions) and
|
||||
(tfieldvarsym(sym).fieldoffset>=offset) then
|
||||
begin
|
||||
result:=tfieldvarsym(sym);
|
||||
@ -1362,7 +1363,8 @@ implementation
|
||||
{ record has one field? }
|
||||
for i:=0 to currentsymlist.Count-1 do
|
||||
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
|
||||
if result then
|
||||
begin
|
||||
|
@ -1058,7 +1058,8 @@ Unit Rax86int;
|
||||
end;
|
||||
if (actasmtoken=AS_DOT) or
|
||||
(assigned(sym) and
|
||||
(sym.typ = fieldvarsym)) then
|
||||
(sym.typ = fieldvarsym) and
|
||||
not(sp_static in sym.symoptions)) then
|
||||
begin
|
||||
BuildRecordOffsetSize(tempstr,l,k,hs,needvmtofs);
|
||||
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