mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-28 17:39:26 +02:00
+ check for local var
This commit is contained in:
parent
61b61fd36d
commit
f0ea08740f
@ -16,6 +16,30 @@ asm
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function get_local_value : longint;
|
||||||
|
var
|
||||||
|
x : longint;
|
||||||
|
begin
|
||||||
|
x:=66;
|
||||||
|
asm
|
||||||
|
mov eax,dword ptr [x]
|
||||||
|
mov @result,eax
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function get_local_addr : pointer;
|
||||||
|
var
|
||||||
|
x : longint;
|
||||||
|
begin
|
||||||
|
x:=66;
|
||||||
|
asm
|
||||||
|
mov eax,x
|
||||||
|
mov @result,eax
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
program_has_error : boolean = false;
|
||||||
{$endif CPU86}
|
{$endif CPU86}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -23,13 +47,25 @@ begin
|
|||||||
sti:=56;
|
sti:=56;
|
||||||
if get_sti_value<>sti then
|
if get_sti_value<>sti then
|
||||||
begin
|
begin
|
||||||
Writeln(' "mov eax,sti" does not get the address of sti var');
|
Writeln(' "mov eax,dword ptr [sti]" does not get the value of static sti var');
|
||||||
Halt(1);
|
program_has_error:=true;
|
||||||
end;
|
end;
|
||||||
if get_sti_addr<>@sti then
|
if get_sti_addr<>@sti then
|
||||||
begin
|
begin
|
||||||
Writeln(' "mov eax,sti" does not get the address of sti var');
|
Writeln(' "mov eax,sti" does not get the address of sti var');
|
||||||
Halt(1);
|
program_has_error:=true;
|
||||||
end;
|
end;
|
||||||
|
if get_local_value<>66 then
|
||||||
|
begin
|
||||||
|
Writeln(' "mov eax,dword ptr [x]" does not get the value of local x var');
|
||||||
|
program_has_error:=true;
|
||||||
|
end;
|
||||||
|
if longint(get_local_addr)=66 then
|
||||||
|
begin
|
||||||
|
Writeln(' "mov eax,x" gets the value of local x var');
|
||||||
|
program_has_error:=true;
|
||||||
|
end;
|
||||||
|
if program_has_error then
|
||||||
|
Halt(1);
|
||||||
{$endif CPU86}
|
{$endif CPU86}
|
||||||
end.
|
end.
|
Loading…
Reference in New Issue
Block a user