[fpc-pascal] AnsiStrupper Error

Jonas Maebe jonas.maebe at elis.ugent.be
Mon May 26 08:04:16 CEST 2014


On 26 May 2014, at 01:59, Daniel Gaspary wrote:

> The code bellow is throwing an exception and I don't know why. It used to work.
> 
> program Project1;
> uses
>    sysutils;
> var
>    s : AnsiString;
> begin
>     s := 'a';
>     AnsiStrupper(PAnsiChar(s));
> end.
> 
> It works fine with FPC 2.6.4 (Linux x86-64 bits).

No, it corrupts your string constant.

> I'm using FPC trunk (Revision 27818):
> 
> An unhandled exception occurred at $0000000000428E4D:
> EAccessViolation: Access violation
>  $0000000000428E4D

And that corruption is now caught: http://wiki.freepascal.org/User_Changes_Trunk#Literal_storage_memory_has_been_made_read-only


Jonas




More information about the fpc-pascal mailing list