mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-25 11:29:37 +02:00
Fix for Mantis #29372.
compiler/ncgcal.pas: * tchcallnode.release_para_temps: don't release temps of a constructor's self parameter + added test git-svn-id: trunk@32990 -
This commit is contained in:
parent
c97504da86
commit
d2a7f17d8c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -14921,6 +14921,7 @@ tests/webtbs/tw2926.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw2927.pp svneol=native#text/plain
|
tests/webtbs/tw2927.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw29321.pp svneol=native#text/pascal
|
tests/webtbs/tw29321.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw29353.pp -text svneol=native#text/plain
|
tests/webtbs/tw29353.pp -text svneol=native#text/plain
|
||||||
|
tests/webtbs/tw29372.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw2942a.pp svneol=native#text/plain
|
tests/webtbs/tw2942a.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2942b.pp svneol=native#text/plain
|
tests/webtbs/tw2942b.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2943.pp svneol=native#text/plain
|
tests/webtbs/tw2943.pp svneol=native#text/plain
|
||||||
|
@ -625,7 +625,14 @@ implementation
|
|||||||
begin
|
begin
|
||||||
{ don't release the funcret temp }
|
{ don't release the funcret temp }
|
||||||
if not(assigned(ppn.parasym)) or
|
if not(assigned(ppn.parasym)) or
|
||||||
not(vo_is_funcret in ppn.parasym.varoptions) then
|
not(
|
||||||
|
(vo_is_funcret in ppn.parasym.varoptions) or
|
||||||
|
(
|
||||||
|
(vo_is_self in ppn.parasym.varoptions) and
|
||||||
|
(procdefinition.proctypeoption=potype_constructor) and
|
||||||
|
(ppn.parasym.vardef.typ<>objectdef)
|
||||||
|
)
|
||||||
|
)then
|
||||||
location_freetemp(current_asmdata.CurrAsmList,ppn.left.location);
|
location_freetemp(current_asmdata.CurrAsmList,ppn.left.location);
|
||||||
{ process also all nodes of an array of const }
|
{ process also all nodes of an array of const }
|
||||||
hp:=ppn.left;
|
hp:=ppn.left;
|
||||||
|
49
tests/webtbs/tw29372.pp
Normal file
49
tests/webtbs/tw29372.pp
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
program tw29372;
|
||||||
|
|
||||||
|
{$MODE DELPHI}
|
||||||
|
type
|
||||||
|
TR1 = record
|
||||||
|
A, B, C: Int64;
|
||||||
|
constructor Create(_A, _B, _C: Int64);
|
||||||
|
end;
|
||||||
|
|
||||||
|
TR2 = record
|
||||||
|
D, E, F: Int64;
|
||||||
|
constructor Create(_D, _E, _F: Int64);
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TR1.Create(_A, _B, _C: Int64);
|
||||||
|
begin
|
||||||
|
A := _A;
|
||||||
|
B := _B;
|
||||||
|
C := _C;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TR2.Create(_D, _E, _F: Int64);
|
||||||
|
begin
|
||||||
|
D := _D;
|
||||||
|
E := _E;
|
||||||
|
F := _F;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ Note: unlike in the file attached at #29372 we use "const" both times to
|
||||||
|
trigger the error on x86_64 as well }
|
||||||
|
procedure Foo(const _1: TR1; const _2: TR2);
|
||||||
|
begin
|
||||||
|
if _1.A <> 1 then
|
||||||
|
Halt(1);
|
||||||
|
if _1.B <> 2 then
|
||||||
|
Halt(2);
|
||||||
|
if _1.C <> 3 then
|
||||||
|
Halt(3);
|
||||||
|
if _2.D <> 4 then
|
||||||
|
Halt(2);
|
||||||
|
if _2.E <> 5 then
|
||||||
|
Halt(5);
|
||||||
|
if _2.F <> 6 then
|
||||||
|
Halt(6);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Foo(TR1.Create(1, 2, 3), TR2.Create(4,5,6));
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user