#1 2017-03-04 14:37:31

cybexr
Member
Registered: 2016-09-14
Posts: 81

FPC dealing RawUTF8 problem

mormot sample 15 - External DB performance

var U:RawUTF8;
...
  U := 'Namee ';
  PWord(@U[4])^ := $a9c3;  // some 'e'acute to test UTF-8 encoding   //Here D7 run OK, but FPC will raise Exception External: SIGSEGV

Can anyone explian this situaion, or is FPC had some problem on dealing RawUTF8 ?

Offline

#2 2017-03-05 07:01:11

cybexr
Member
Registered: 2016-09-14
Posts: 81

Re: FPC dealing RawUTF8 problem

U := 'Namee ';
  UniqueString(U);   //Add this line FPC will OK
  PWord(@U[4])^ := $a9c3;  // some 'e'acute to test UTF-8 encoding     

after doing some research on ASM code & Syncomms.pas, I found that add UniqueString() seems work fine.  But I'm not sure whether it will cause memory leak ?

Offline

#3 2017-03-06 10:06:48

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: FPC dealing RawUTF8 problem

Yes, this is a FPC inconsistency in respect to Delphi: @aString[] does not call UniqueString.
Please check https://synopse.info/fossil/info/dcfa37ee3f
The fix won't cause a memory leak.

Offline

#4 2017-03-06 10:51:49

hnb
Member
Registered: 2015-06-15
Posts: 290

Re: FPC dealing RawUTF8 problem

@ab did we have any bugreport on FPC mantis for this?


best regards,
Maciej Izak

Offline

#5 2017-03-06 13:05:03

cybexr
Member
Registered: 2016-09-14
Posts: 81

Re: FPC dealing RawUTF8 problem

@ab got it , thank you

Offline

Board footer

Powered by FluxBB