Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-05

AnsiStrupper Error

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Daniel Gaspary

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).

I'm using FPC trunk (Revision 27818):

An unhandled exception occurred at $0000000000428E4D: EAccessViolation: Access violation
$0000000000428E4D

Jonas Maebe
to Daniel Gaspary
Daniel Gaspary wrote 13 lines
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.

Show quoted text 5 lines
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