mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-07 13:46:02 +02:00
+ support for [recordfield.field] in assembler blocks in methods in
intel assembler (mantis 8171) git-svn-id: trunk@6150 -
This commit is contained in:
parent
fcb128c66c
commit
ed13c7f60e
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -7991,6 +7991,7 @@ tests/webtbs/tw8150a.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw8150d.pp svneol=native#text/plain
|
tests/webtbs/tw8150d.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw8155.pp svneol=native#text/plain
|
tests/webtbs/tw8155.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw8156.pp svneol=native#text/plain
|
tests/webtbs/tw8156.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw8171.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw8183.pp svneol=native#text/plain
|
tests/webtbs/tw8183.pp svneol=native#text/plain
|
||||||
tests/webtbs/ub1873.pp svneol=native#text/plain
|
tests/webtbs/ub1873.pp svneol=native#text/plain
|
||||||
tests/webtbs/ub1883.pp svneol=native#text/plain
|
tests/webtbs/ub1883.pp svneol=native#text/plain
|
||||||
|
@ -1202,6 +1202,14 @@ Begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
fieldvarsym :
|
||||||
|
begin
|
||||||
|
if (tfieldvarsym(srsym).vardef.typ in [recorddef,objectdef]) then
|
||||||
|
begin
|
||||||
|
SearchRecordType:=true;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -982,6 +982,10 @@ Unit Rax86int;
|
|||||||
if not(ttypesym(sym).typedef.typ in [recorddef,objectdef]) then
|
if not(ttypesym(sym).typedef.typ in [recorddef,objectdef]) then
|
||||||
Message(asmr_e_wrong_sym_type);
|
Message(asmr_e_wrong_sym_type);
|
||||||
end;
|
end;
|
||||||
|
fieldvarsym :
|
||||||
|
begin
|
||||||
|
tempstr:='SELF.'+tempstr;
|
||||||
|
end;
|
||||||
else
|
else
|
||||||
Message(asmr_e_wrong_sym_type);
|
Message(asmr_e_wrong_sym_type);
|
||||||
end;
|
end;
|
||||||
@ -1014,7 +1018,9 @@ Unit Rax86int;
|
|||||||
else
|
else
|
||||||
Message(asmr_e_only_add_relocatable_symbol);
|
Message(asmr_e_only_add_relocatable_symbol);
|
||||||
end;
|
end;
|
||||||
if actasmtoken=AS_DOT then
|
if (actasmtoken=AS_DOT) or
|
||||||
|
(assigned(sym) and
|
||||||
|
(sym.typ = fieldvarsym)) then
|
||||||
begin
|
begin
|
||||||
BuildRecordOffsetSize(tempstr,l,k,hs);
|
BuildRecordOffsetSize(tempstr,l,k,hs);
|
||||||
if hs <> '' then
|
if hs <> '' then
|
||||||
|
37
tests/webtbs/tw8171.pp
Normal file
37
tests/webtbs/tw8171.pp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{ %cpu=i386 }
|
||||||
|
|
||||||
|
program FieldDoesntResolve;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$mode delphi}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
type
|
||||||
|
TMyRecord = record
|
||||||
|
rField: Integer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TMyObject = class
|
||||||
|
private
|
||||||
|
oField: TMyRecord;
|
||||||
|
public
|
||||||
|
procedure Test;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TMyObject }
|
||||||
|
|
||||||
|
procedure TMyObject.Test;
|
||||||
|
asm
|
||||||
|
// mov [eax + TMyObject.oField.rField], 0 // works in Delphi and FPC
|
||||||
|
mov [eax + oField.rField], 5 // works only in Delphi
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
with TMyObject.Create do try
|
||||||
|
Test;
|
||||||
|
finally
|
||||||
|
if (ofield.rfield <> 5) then
|
||||||
|
halt(1);
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user