[fpc-devel]FPC_CHECKPOINTER

Pierre Muller pierre at freepascal.org
Thu Jun 20 09:21:50 CEST 2002


At 21:09 15/06/2002 , Sergey Korshunoff a écrit:
>Hi!
>
>In which cases FPC generates a call to SUBJ? Can I assume that 
>FPC_CHECKPOINTER would get as parameter only an allocated by GetMem pointer
>(in normal cases) ?
>
>This question is because I get a SYSSEGV when use
>             OPT='-gc -gh" make all
>under Linux.

I tested this out, and I got a
Run Time Error 216
generated by heaptrc.pp unit
because the linux version of the FPC_CHECKPOINTER function is wrong,
in the sense that it does not accept pointers that point inside the valid stack range ...


>I want to add some additional check (under Linux) before dereferencing a 
>given poiner.
>
>Regards,
>         Sergey Korshunoff

I added some code to fix the problem,
and it now seems that it does not generate errors anymore,
but getting the cycle to an end seems a pretty lengthy
topic, as the FPC_CHECKPOINTER function is not optimized at all 
and does a linear search through all allocated blocks
to test if the dereferenced pointer is valid...
This takes ages...
The compilation of the linux system unit with a compiler 
calling FPC_CHECKPOINTER on each deref
it finished after 4 hours of computation,
when a normal compilation only takes a few seconds in 
normal conditions.





More information about the fpc-devel mailing list