[fpc-pascal] Runtime Error 216

Jonas Maebe jonas at zeus.ugent.be
Mon Jan 3 20:22:57 CET 2005


On 3 jan 2005, at 19:36, Bartek wrote:

> after installing the new 1.9.6 release i tried to recompile and run my 
> sdl programs. compilation runs fine ( but i had to restruct the 
> majority of my for-loops, not beeing allowed to modify the counter 
> variable ;\ ),

Delphi does not allow members of records to be used as counters at all. 
We're probably going to do the same thing in the future, because 
checking whether or not a counter variable is modified in a loop is 
incompatible with the way record field symbols are stored (as you 
discovered before).

> but when i run my programs they all crashed beacuse of an access 
> violation. this snippet is causing the crash. i'm not sure if it is my 
> fault.
>
> thanks in advance
> bartek
>
> program bug3;
> type
>  PSDL_Surface = ^TSDL_Surface;
>  TSDL_Surface = record
>    offset: Integer;
>  end;
> var
>        screen          :psdl_surface;
>
> function SDL_MustLock(Surface: pSDL_Surface): Boolean;
> begin
>  Result := ( surface^.offset <> 0 );
> end;
>
> begin
> getmem(screen,sizeof(tsdl_surface));
> sdl_mustlock(screen);
> freemem(screen)
> end.

I can't reproduce this crash under Linux. Can you try with all 
optimizations turned off?


Jonas





More information about the fpc-pascal mailing list