mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 13:49:17 +02:00
LLVM: always added related high parameters to parentfpstruct
Sometimes the high parameter is only first accessed during the first pass, while we already need to know everything that will go into the parentfpstruct during the typechecking pass. resolves #41282
This commit is contained in:
parent
ae45947cb4
commit
5f215e8126
@ -1990,6 +1990,7 @@ implementation
|
||||
old_filepos: tfileposinfo;
|
||||
symname,
|
||||
symrealname: TSymStr;
|
||||
highsym: tabstractvarsym;
|
||||
begin
|
||||
nestedvarsdef:=tlocalvarsym(pd.parentfpstruct).vardef;
|
||||
{ redirect all aliases for the function result also to the function
|
||||
@ -2044,6 +2045,13 @@ implementation
|
||||
tblocknode(pd.parentfpinitblock).left:=cstatementnode.create
|
||||
(initcode,tblocknode(pd.parentfpinitblock).left);
|
||||
current_filepos:=old_filepos;
|
||||
|
||||
{ also add the associated high para, if any. It may not be accessed
|
||||
during code generation, and we need to catch 'em all (TM) during
|
||||
the typecheck/firstpass }
|
||||
highsym:=get_high_value_sym(tparavarsym(sym));
|
||||
if assigned(highsym) then
|
||||
maybe_add_sym_to_parentfpstruct(pd, highsym, highsym.vardef, false);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
23
tests/webtbs/tw41282.pp
Normal file
23
tests/webtbs/tw41282.pp
Normal file
@ -0,0 +1,23 @@
|
||||
{$mode delphi}
|
||||
|
||||
Program test;
|
||||
|
||||
procedure outer_proc(var outer: ShortString);
|
||||
|
||||
procedure inner_proc;
|
||||
Begin
|
||||
outer := 'abc';
|
||||
End;
|
||||
|
||||
Begin
|
||||
inner_proc();
|
||||
End;
|
||||
|
||||
var
|
||||
s: shortstring;
|
||||
|
||||
Begin
|
||||
outer_proc(s);
|
||||
if s<>'abc' then
|
||||
halt(1);
|
||||
End.
|
Loading…
Reference in New Issue
Block a user