mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 10:19:19 +02:00
* if an outer capturer is required then that outer capturer must not be optimized into a register (fixes compilation with -Ooregvar enabled (e.g. in -O3))
This commit is contained in:
parent
5c4db7dbca
commit
155756f668
@ -656,8 +656,13 @@ implementation
|
|||||||
begin
|
begin
|
||||||
{$ifdef DEBUG_CAPTURER}writeln('Adding field OuterSelf to ',subcapturer.typesym.name);{$endif}
|
{$ifdef DEBUG_CAPTURER}writeln('Adding field OuterSelf to ',subcapturer.typesym.name);{$endif}
|
||||||
if subcapturer.owner.symtablelevel>normal_function_level then
|
if subcapturer.owner.symtablelevel>normal_function_level then
|
||||||
{ the outer self is the capturer of the outer procdef }
|
begin
|
||||||
sym:=get_or_create_capturer(curpd)
|
{ the outer self is the capturer of the outer procdef }
|
||||||
|
sym:=get_or_create_capturer(curpd);
|
||||||
|
{ ensure that the outer capturer isn't put into a register anymore }
|
||||||
|
tabstractvarsym(sym).different_scope:=true;
|
||||||
|
tabstractvarsym(sym).varregable:=vr_none;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ the outer self is the self of the method }
|
{ the outer self is the self of the method }
|
||||||
@ -1383,10 +1388,12 @@ implementation
|
|||||||
if not assigned(outercapturer) then
|
if not assigned(outercapturer) then
|
||||||
internalerror(2022011605);
|
internalerror(2022011605);
|
||||||
selfnode:=cloadnode.create(outercapturer,outercapturer.owner);
|
selfnode:=cloadnode.create(outercapturer,outercapturer.owner);
|
||||||
|
make_not_regable(selfnode,[ra_different_scope]);
|
||||||
outeralive:=get_capturer_alive(tprocdef(ctx.procdef.owner.defowner));
|
outeralive:=get_capturer_alive(tprocdef(ctx.procdef.owner.defowner));
|
||||||
if not assigned(outeralive) then
|
if not assigned(outeralive) then
|
||||||
internalerror(2022051706);
|
internalerror(2022051706);
|
||||||
alivenode:=cloadnode.create(outeralive,outeralive.owner);
|
alivenode:=cloadnode.create(outeralive,outeralive.owner);
|
||||||
|
make_not_regable(alivenode,[ra_different_scope]);
|
||||||
end;
|
end;
|
||||||
addstatement(stmt,cassignmentnode.create(
|
addstatement(stmt,cassignmentnode.create(
|
||||||
csubscriptnode.create(
|
csubscriptnode.create(
|
||||||
|
Loading…
Reference in New Issue
Block a user