mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 22:59:21 +02:00
* check callerside if calleeside isn't available in is_ecx_used. Based on the
patch by Do-wan Kim, mantis #25269. git-svn-id: trunk@26101 -
This commit is contained in:
parent
a13f479b50
commit
fbca7ee2cb
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13646,6 +13646,7 @@ tests/webtbs/tw2514.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw25198.pp svneol=native#text/plain
|
tests/webtbs/tw25198.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw25210.pp svneol=native#text/pascal
|
tests/webtbs/tw25210.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw2525.pp svneol=native#text/plain
|
tests/webtbs/tw2525.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw25269.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw2536.pp svneol=native#text/plain
|
tests/webtbs/tw2536.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2540.pp svneol=native#text/plain
|
tests/webtbs/tw2540.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2561.pp svneol=native#text/plain
|
tests/webtbs/tw2561.pp svneol=native#text/plain
|
||||||
|
@ -648,13 +648,21 @@ unit cgcpu;
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
hp: tparavarsym;
|
hp: tparavarsym;
|
||||||
paraloc: PCGParaLocation;
|
paraloc: PCGParaLocation;
|
||||||
|
side: tcallercallee;
|
||||||
begin
|
begin
|
||||||
if not (RS_ECX in paramanager.get_volatile_registers_int(procdef.proccalloption)) then
|
if not (RS_ECX in paramanager.get_volatile_registers_int(procdef.proccalloption)) then
|
||||||
exit(true);
|
exit(true);
|
||||||
for i:=0 to procdef.paras.count-1 do
|
for i:=0 to procdef.paras.count-1 do
|
||||||
begin
|
begin
|
||||||
hp:=tparavarsym(procdef.paras[i]);
|
hp:=tparavarsym(procdef.paras[i]);
|
||||||
paraloc:=hp.paraloc[calleeside].Location;
|
if procdef.has_paraloc_info in [calleeside,callbothsides] then
|
||||||
|
side:=calleeside
|
||||||
|
{ in the case of virtual abstract methods, we only have callerside }
|
||||||
|
else if procdef.has_paraloc_info=callerside then
|
||||||
|
side:=callerside
|
||||||
|
else
|
||||||
|
internalerror(2013111601);
|
||||||
|
paraloc:=hp.paraloc[side].Location;
|
||||||
while paraloc<>nil do
|
while paraloc<>nil do
|
||||||
begin
|
begin
|
||||||
if (paraloc^.Loc=LOC_REGISTER) and (getsupreg(paraloc^.register)=RS_ECX) then
|
if (paraloc^.Loc=LOC_REGISTER) and (getsupreg(paraloc^.register)=RS_ECX) then
|
||||||
|
31
tests/webtbs/tw25269.pp
Normal file
31
tests/webtbs/tw25269.pp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{$MODE objfpc}
|
||||||
|
|
||||||
|
type
|
||||||
|
IMyInterface = interface
|
||||||
|
procedure Test(a, b: Integer);
|
||||||
|
end;
|
||||||
|
TMyBaseClass = class(TInterfacedObject, IMyInterface)
|
||||||
|
procedure Test(a, b: Integer); virtual; abstract;
|
||||||
|
end;
|
||||||
|
TDescendent = class(TMyBaseClass)
|
||||||
|
procedure Test(a, b: Integer); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
global_a, global_b: Integer;
|
||||||
|
|
||||||
|
procedure TDescendent.Test(a, b: Integer);
|
||||||
|
begin
|
||||||
|
global_a := a;
|
||||||
|
global_b := b;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
q: IMyInterface;
|
||||||
|
begin
|
||||||
|
q := TDescendent.Create;
|
||||||
|
q.Test(18, 42);
|
||||||
|
if (global_a <> 18) or (global_b <> 42) then
|
||||||
|
halt(1);
|
||||||
|
Writeln('Ok!');
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user