mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-22 23:29:13 +02:00
* make self-pointer passed by reference not regable. Was not necessary
when we only had objects because they are never put in registers, but (advanced) records can be (mantis #21177) git-svn-id: trunk@20192 -
This commit is contained in:
parent
7c9b93dd91
commit
1f83203117
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -12179,6 +12179,7 @@ tests/webtbs/tw2109.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2110.pp svneol=native#text/plain
|
||||
tests/webtbs/tw21146.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw21151.pp svneol=native#text/plain
|
||||
tests/webtbs/tw21177.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2128.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2129.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2129b.pp svneol=native#text/plain
|
||||
|
@ -2337,6 +2337,12 @@ implementation
|
||||
para.left:=gen_procvar_context_tree
|
||||
else
|
||||
para.left:=gen_self_tree;
|
||||
{ make sure that e.g. the self pointer of an advanced
|
||||
record does not become a regvar, because it's a vs_var
|
||||
parameter }
|
||||
if paramanager.push_addr_param(para.parasym.varspez,para.parasym.vardef,
|
||||
procdefinition.proccalloption) then
|
||||
make_not_regable(para.left,[ra_addr_regable]);
|
||||
end
|
||||
else
|
||||
if vo_is_vmt in para.parasym.varoptions then
|
||||
|
29
tests/webtbs/tw21177.pp
Normal file
29
tests/webtbs/tw21177.pp
Normal file
@ -0,0 +1,29 @@
|
||||
{$modeswitch ADVANCEDRECORDS}
|
||||
{$OPTIMIZATION REGVAR}
|
||||
program record_bug;
|
||||
|
||||
type
|
||||
TColor = object
|
||||
R : Byte;
|
||||
function toDWord : DWord;
|
||||
end;
|
||||
|
||||
function TColor.toDWord : DWord;
|
||||
begin
|
||||
r:=4;
|
||||
toDWord:=5;
|
||||
end;
|
||||
|
||||
procedure Fill(Color: TColor);
|
||||
begin
|
||||
Color.toDWord;
|
||||
if color.r<>4 then
|
||||
halt(1);
|
||||
end;
|
||||
|
||||
var
|
||||
c: TColor;
|
||||
begin
|
||||
c.r:=1;
|
||||
Fill(c);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user