Assembler function with nostackframe have wrong code generated.
Original Reporter info from Mantis: payl
-
Reporter name: Paul W
Original Reporter info from Mantis: payl
- Reporter name: Paul W
Description:
Simple code:
program NoStackTest;
{$mode objfpc}{$ASMMODE INTEL}
function Test():byte;assembler;nostackframe;
asm
mov result,1
end;
begin
writeln(Test());
end.
FPC generate following code for function Test:
mov byte [ebp-4], 1
mov al, [ebp-4]
retn
This code lead to crash.
Simple workaround is changing result to eax.
Mantis conversion info:
- Mantis ID: 22490
- Version: 2.6.0
- Fixed in version: 3.0.0
- Fixed in revision: 22166 (#288d1ec7)