diff --git a/.gitattributes b/.gitattributes index 4b7c4f85b3..f5144330bc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8623,6 +8623,7 @@ tests/webtbs/tw1066a.pp svneol=native#text/plain tests/webtbs/tw1066b.pp svneol=native#text/plain tests/webtbs/tw1068.pp svneol=native#text/plain tests/webtbs/tw10681.pp svneol=native#text/plain +tests/webtbs/tw10684.pp svneol=native#text/plain tests/webtbs/tw1071.pp svneol=native#text/plain tests/webtbs/tw10727.pp svneol=native#text/plain tests/webtbs/tw1073.pp svneol=native#text/plain diff --git a/compiler/i386/cgcpu.pas b/compiler/i386/cgcpu.pas index 269a111118..d2bd151e3e 100644 --- a/compiler/i386/cgcpu.pas +++ b/compiler/i386/cgcpu.pas @@ -563,7 +563,7 @@ unit cgcpu; } - procedure getselftoeax(offs: longint); + procedure getselftoeax(offs: longint); var href : treference; selfoffsetfromsp : longint; @@ -581,7 +581,7 @@ unit cgcpu; end; end; - procedure loadvmttoeax; + procedure loadvmttoeax; var href : treference; begin @@ -590,7 +590,7 @@ unit cgcpu; cg.a_load_ref_reg(list,OS_ADDR,OS_ADDR,href,NR_EAX); end; - procedure op_oneaxmethodaddr(op: TAsmOp); + procedure op_oneaxmethodaddr(op: TAsmOp); var href : treference; begin @@ -601,7 +601,7 @@ unit cgcpu; list.concat(taicpu.op_ref(op,S_L,href)); end; - procedure loadmethodoffstoeax; + procedure loadmethodoffstoeax; var href : treference; begin @@ -633,9 +633,9 @@ unit cgcpu; make_global:=true; if make_global then - List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0)) + List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0)) else - List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0)); + List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0)); { set param1 interface to self } g_adjust_self_value(list,procdef,ioffset); @@ -657,6 +657,7 @@ unit cgcpu; end; { restore param1 value self to interface } g_adjust_self_value(list,procdef,-ioffset); + list.concat(taicpu.op_none(A_RET,S_L)); end else if po_virtualmethod in procdef.procoptions then begin diff --git a/tests/webtbs/tw10684.pp b/tests/webtbs/tw10684.pp new file mode 100644 index 0000000000..52dcac4f7a --- /dev/null +++ b/tests/webtbs/tw10684.pp @@ -0,0 +1,48 @@ +program test_intf_query; + +{$IFDEF FPC} + {$MODE OBJFPC}{$H+} +{$ENDIF} + +uses + Classes; + +type + ISimple = interface + ['{24811FF3-4F01-4601-AC5C-22A5B5D46928}'] + function ShowSomething: Integer; cdecl; + function GetIsBlob: Boolean; cdecl; + end; + + TSimple = class(TInterfacedObject, ISimple) + protected + { ISimple implementation } + function ShowSomething: Integer; cdecl; + function GetIsBlob: Boolean; cdecl; + end; + +function QuerySimple(const OnChange: TNotifyEvent = nil): ISimple; cdecl; +begin + Result := TSimple.Create; +end; + +function TSimple.ShowSomething: Integer; cdecl; +begin + Writeln('Message from ISimple'); + Result := 0; +end; + +function TSimple.GetIsBlob: Boolean; cdecl; +begin + Result := true; +end; + +{*** main program ***} + +var + FSimple: ISimple; + +begin + FSimple := QuerySimple; + FSimple.ShowSomething; +end. \ No newline at end of file