[fpc-pascal] Re: nostackframe -- possible to create faulty code?

Bernd prof7bit at googlemail.com
Tue Dec 13 16:17:54 CET 2011


2011/12/13 Bernd <prof7bit at googlemail.com>:
> An unhandled exception occurred at $0806A90B :
> EAccessViolation : Access violation
>  $0806A90B  ADDMOVE,  line 61 of chess_movegen_inc.pas
>  $0806FAD2  TBOARD__PERFT,  line 33 of chess_search_inc.pas
>  $08066832  DOCOMMAND,  line 263 of chess_interface.pas
>  $08066D73  RUN,  line 359 of chess_interface.pas
>  $0804825D  main,  line 9 of fpwinglet.lpr
>
> Line 61 is:
>    MoveBuffer[Index] := Move;



  procedure AddMove; nostackframe;
  begin
    MoveBuffer[Index] := Move;
0x806a8e9 mov    eax,DWORD PTR [ebp-0x4]  <-- this is correct: eax := Index
0x806a8ec mov    ecx,DWORD PTR [eax-0x8]  <-- now what is this? makes no sense
0x806a8ef mov    eax,DWORD PTR [ebp-0x4]  <-- again?
0x806a8f2 mov    eax,DWORD PTR [eax-0x4]  <-- and again no sense?
0x806a8f5 imul   eax,eax,0x14                            <-- 0x14
would be SizeOf(TMove), correct.
0x806a8f8 mov    edx,DWORD PTR [ebp-0x4]  <-- edx := Index
0x806a8fb lea    edi,[ecx+eax*1+0x50a8]          <-- this cannot end well....
0x806a902 lea    esi,[edx-0x4c]                           <-- edx is
not an address!!
0x806a905 cld
0x806a906 mov    ecx,0x5
0x806a90b rep movs DWORD PTR es:[edi],DWORD PTR ds:[esi]  <-- here the crach
    Inc(Index);
0x806a90d mov    eax,DWORD PTR [ebp-0x4]
0x806a910 inc    DWORD PTR [eax-0x4]



More information about the fpc-pascal mailing list