mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-18 06:01:41 +02:00
* access static fields by a absolute sym pointing to the symbol for the space allocation, resolves #14124
git-svn-id: trunk@13512 -
This commit is contained in:
parent
6a6a6a6e6f
commit
10ede51609
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -9215,6 +9215,7 @@ tests/webtbs/tw1407.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1408.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1409.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1412.pp svneol=native#text/plain
|
||||
tests/webtbs/tw14124.pp svneol=native#text/plain
|
||||
tests/webtbs/tw14134.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1414.pp svneol=native#text/plain
|
||||
tests/webtbs/tw14143.pp svneol=native#text/plain
|
||||
@ -10104,6 +10105,7 @@ tests/webtbs/uw13345b.pp svneol=native#text/plain
|
||||
tests/webtbs/uw13345c.pp svneol=native#text/plain
|
||||
tests/webtbs/uw13345y.pp svneol=native#text/plain
|
||||
tests/webtbs/uw13583.pp svneol=native#text/plain
|
||||
tests/webtbs/uw14124.pp svneol=native#text/plain
|
||||
tests/webtbs/uw2004.inc svneol=native#text/plain
|
||||
tests/webtbs/uw2040.pp svneol=native#text/plain
|
||||
tests/webtbs/uw2266a.inc svneol=native#text/plain
|
||||
|
@ -1315,6 +1315,7 @@ implementation
|
||||
tempdef: tdef;
|
||||
is_first_field: boolean;
|
||||
{$endif powerpc or powerpc64}
|
||||
sl : tpropaccesslist;
|
||||
begin
|
||||
recst:=tabstractrecordsymtable(symtablestack.top);
|
||||
{$if defined(powerpc) or defined(powerpc64)}
|
||||
@ -1429,9 +1430,14 @@ implementation
|
||||
begin
|
||||
fieldvs:=tfieldvarsym(sc[i]);
|
||||
include(fieldvs.symoptions,sp_static);
|
||||
hstaticvs:=tstaticvarsym.create('$'+lower(symtablestack.top.name^)+'_'+fieldvs.name,vs_value,hdef,[]);
|
||||
{ generate the symbol which reserves the space }
|
||||
hstaticvs:=tstaticvarsym.create('$_static_'+lower(symtablestack.top.name^)+'_'+fieldvs.name,vs_value,hdef,[]);
|
||||
recst.defowner.owner.insert(hstaticvs);
|
||||
insertbssdata(hstaticvs);
|
||||
{ generate the symbol for the access }
|
||||
sl:=tpropaccesslist.create;
|
||||
sl.addsym(sl_load,hstaticvs);
|
||||
recst.insert(tabsolutevarsym.create_ref('$'+lower(symtablestack.top.name^)+'_'+fieldvs.name,hdef,sl));
|
||||
end;
|
||||
consume(_SEMICOLON);
|
||||
end;
|
||||
|
@ -1200,12 +1200,14 @@ implementation
|
||||
begin
|
||||
if (sp_static in sym.symoptions) then
|
||||
begin
|
||||
static_name:=lower(sym.owner.name^)+'_'+sym.name;
|
||||
searchsym(static_name,sym,srsymtable);
|
||||
if assigned(sym) then
|
||||
check_hints(sym,sym.symoptions);
|
||||
p1.free;
|
||||
p1:=cloadnode.create(sym,srsymtable);
|
||||
static_name:=lower(sym.owner.name^)+'_'+sym.name;
|
||||
searchsym_in_class(tobjectdef(sym.owner.defowner),tobjectdef(sym.owner.defowner),static_name,sym,srsymtable);
|
||||
if assigned(sym) then
|
||||
check_hints(sym,sym.symoptions);
|
||||
p1.free;
|
||||
p1:=nil;
|
||||
{ static syms are always stored as absolutevarsym to handle scope and storage properly }
|
||||
propaccesslist_to_node(p1,nil,tabsolutevarsym(sym).ref);
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
11
tests/webtbs/tw14124.pp
Normal file
11
tests/webtbs/tw14124.pp
Normal file
@ -0,0 +1,11 @@
|
||||
program project1;
|
||||
|
||||
uses
|
||||
uw14124;
|
||||
|
||||
type
|
||||
|
||||
T = specialize TGenericType<Integer>;
|
||||
|
||||
begin
|
||||
end.
|
24
tests/webtbs/uw14124.pp
Normal file
24
tests/webtbs/uw14124.pp
Normal file
@ -0,0 +1,24 @@
|
||||
unit uw14124;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$static on}
|
||||
|
||||
interface
|
||||
|
||||
type
|
||||
generic TGenericType<TParamType> = class
|
||||
var private
|
||||
FDefault: TParamType; static;
|
||||
F: TParamType;
|
||||
public
|
||||
procedure P;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
procedure TGenericType.P;
|
||||
begin
|
||||
F := FDefault; // <====== unit1.pas(21,16) Fatal: Internal error 200108121
|
||||
end;
|
||||
|
||||
end.
|
Loading…
Reference in New Issue
Block a user