View Issue Details

IDProjectCategoryView StatusLast Update
0036866FPCFCLpublic2020-04-04 15:22
ReporterRobert Werner Assigned ToMichael Van Canneyt  
Status resolvedResolutionunable to reproduce 
PlatformCore I5-7400 CPU @ 3.00 GHZOSWindows 7 Ultimate 
Product Version3.0.4 
Summary0036866: AnsiProperCase
DescriptionDE: Beim Funktionsaufruf mit kleinbuchstaben ohne GroƟbuchstaben gibte es eine SIGSEGV Fehlermeldung.

EN: A SIGSEGV error message was issued when calling the function with lower case letters without capital letters.
Steps To ReproduceHere is the Source Code

procedure TForm1.Button1Click(Sender: TObject);
  Satz, SatzGross: string;
  //nur kleine Schrift EN only little Letters
  Satz := 'erich meyer';
  //The crash
  SatzGross := AnsiProperCase(Satz, [' ']);
  ShowMessage('Aus: ' + Satz + 0000013#10 + 'Wird: ' + SatzGross);
TagsNo tags attached.
Fixed in Revision
Attached Files


jamie philbrook

2020-04-03 23:13

reporter   ~0121871

I can confirm this...


In that the function fails after it returns from the call..

 I tried same type of code using UpCase in a test, it crashes...

 It crashes after it returns from the call and when it stores the results back..

 Looks like a BP pointers is corrupted or some how the pointer value changed.
unit1.pas:252 P^:=UpCase(P^);
0000000100031E41 488b45d8 mov -0x28(%rbp),%rax
0000000100031E45 0fb608 movzbl (%rax),%ecx
0000000100031E48 e81344fdff callq 0x100006260 <SYSTEM_$$_UPCASE$CHAR$$CHAR>
0000000100031E4D 488b55d8 mov -0x28(%rbp),%rdx
0000000100031E51 8802 mov %al,(%rdx) // debug stops here..

Marco van de Voort

2020-04-03 23:15

manager   ~0121872

Works fine for me, attached is the test.

Aus: erich meyer
Wird: Erich Meyer
bug36866.pp (275 bytes)   
{$mode delphi}

uses strutils;

  Satz, SatzGross: string;
  //nur kleine Schrift EN only little Letters
  Satz := 'erich meyer';
  //The crash
  SatzGross := AnsiProperCase(Satz, [' ']);
  writeln('Aus: ' + Satz + #13#10 + 'Wird: ' + SatzGross);
bug36866.pp (275 bytes)   

jamie philbrook

2020-04-03 23:19

reporter   ~0121873

Last edited: 2020-04-03 23:28

View 2 revisions

well it crashes on me,,

Btw, I did this with the 64 bit target in Lazarus...

Have not tried in 32 bit mode, I bet it would work..

Bart Broersma

2020-04-03 23:44

reporter   ~0121875

No crash here with either 32 or 64 bit fpc (trunk r44297, fpc 3.2.0RC1, fpc 3.0.4).

jamie philbrook

2020-04-03 23:50

reporter   ~0121876

Ok, I found the issue..

AnsiProperCase is using Pchar's on the string and he is basically giving it a constant string that is not writeable...
Satz := 'erich meyer';
UniqueString(Satz); // fixes the issue...
   //The crash
   SatzGross := AnsiProperCase(Satz, [' ']);

jamie philbrook

2020-04-04 04:42

reporter   ~0121881

I don't know what to tell you, I've seen this before myself when attempting to make changes to a string that was placed in Read only memory.. Using the UniqueString recreates it to a editable string.
  This is something I remembered that was changed in the compiler. I don't understand why you don't see it.

  I am on a Windows 10 PC and I did this in a windows GUI not console.

Michael Van Canneyt

2020-04-04 15:22

administrator   ~0121898

Can't reproduce with ansistrings or shortstrings in trunk and 3.2.0 beta of FPC, so I assume it was fixed in trunk.
Please test with the 3.2.0 beta of Lazarus, if it still occurs, you can reopen the bugreport.


Issue History

Date Modified Username Field Change
2020-04-03 22:01 Robert Werner New Issue
2020-04-03 23:13 jamie philbrook Note Added: 0121871
2020-04-03 23:15 Marco van de Voort File Added: bug36866.pp
2020-04-03 23:15 Marco van de Voort Note Added: 0121872
2020-04-03 23:19 jamie philbrook Note Added: 0121873
2020-04-03 23:28 jamie philbrook Note Edited: 0121873 View Revisions
2020-04-03 23:44 Bart Broersma Note Added: 0121875
2020-04-03 23:50 jamie philbrook Note Added: 0121876
2020-04-04 04:42 jamie philbrook Note Added: 0121881
2020-04-04 15:22 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-04-04 15:22 Michael Van Canneyt Status new => resolved
2020-04-04 15:22 Michael Van Canneyt Resolution open => unable to reproduce
2020-04-04 15:22 Michael Van Canneyt FPCTarget => -
2020-04-04 15:22 Michael Van Canneyt Note Added: 0121898