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

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to