[fpc-devel] Should the compiler work, if compiled with -Cr?

Flávio Etrusco flavio.etrusco at gmail.com
Sat Mar 16 19:43:04 CET 2013


>
> The particular crash in question is by
>   cstringpattern: AnsiString;
>               len:=length(cstringpattern);
>               recordtokenbuf.write(cstringpattern[1],len);
> with a len of zero, writing 0 bytes from an address that is out of range.
>
>
> Could be solved by using
>  {$PUSH} {$R-}
>  {$POP}
> around those lines.
>

Or typecast it to PChar...
I always found it a PITA that Delphi raises an Exception when
accessing the ending #0 with $R+ :-/

-Flávio



More information about the fpc-devel mailing list