[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2

2021-05-20 Thread NetSpirit via fpc-devel
Answer for my previous message (https://lists.freepascal.org/pipermail/fpc-devel/2021-January/043512.html). Memory leak happens when unit 'rtl\win32\sysinitpas.pp' compiled with "-O2" or higher. To eliminate this bug add "-O-" or "-OoNOREGVAR" to command-line when compile this unit. This disables

Re: [fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2

2021-05-20 Thread J. Gareth Moreton via fpc-devel
Hmmm, I've seen regvar problems before.  Can you provide the assembly dumps of that file under -O2 and -O2 -OoNOREGVAR respectively? It might reveal something. Gareth aka. Kit On 20/05/2021 09:07, NetSpirit via fpc-devel wrote: Answer for my previous message (https://lists.freepascal.org/pipe

[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2

2021-05-20 Thread NetSpirit via fpc-devel
You can simply compile this file by yourself using your existing FPC installation. 1) Get 'rtl\win32\sysinitpas.pp' and 'rtl\win32\sysinit.inc' from repository or sources archive. 2) Create build script ('compile.bat'): REM Change this path's to your FPC installation, e.g.: set FPC_DIR=c:\FPC set

[fpc-devel] Pascal JIT

2021-05-20 Thread ti hory via fpc-devel
Hi, I'm interested in implement a Pascal JIT linker so I implement a COFF 64bit linker and link object files generated by FPC trunk then link them with DLL dependencies like "kernel32.dll" and "user32.dll". Project source code is available at https://github.com/tihorygit/TheLinker. Now I hav

Re: [fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2

2021-05-20 Thread Yuriy Sydorov via fpc-devel
Hello, Your test program runs fine when compiled with FPC 3.2.0 using the official RTL compiled with -O2. No memory leak. I suppose the issue is caused by your modifications to RTL. -O2 (regvars) just triggers the problem in the modified RTL code which is hidden when regvars are disabled. You

[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2

2021-05-20 Thread NetSpirit via fpc-devel
RTL not modified. Just recompilation of 'sysinitpas.pp' unit with some options causes problem. Here is another test project that uses your current official FPC installation with unmodified RTL: http://dl.free.fr/ePtkQwgJJ Test project contains source of 'sysinitpas.pp' (and required 'sysinit.inc'

Re: [fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2

2021-05-20 Thread Yuriy Sydorov via fpc-devel
Hello, I've take a look at you RTL compile script and found the mess with the compiler options. When compiling RTL you should disable reading of options from fpc.cfg using the -n switch. When compiling the system unit use the -Us switch. Additionally specify only CPU/Target and optimization op

[fpc-devel] TypeInfo GetSetProp and GetEnumName

2021-05-20 Thread Martin Frb via fpc-devel
Looking through some code in unit TypInfo in relation to https://bugs.freepascal.org/view.php?id=38915 RTTI for a set, only specifies the size in bytes. (TTypeDate.SetSize) GetSetProp / SetToString iterate over all bits on the given byte size. Since in many cases this is more than the actual amou

Re: [fpc-devel] TypeInfo GetSetProp and GetEnumName

2021-05-20 Thread Martin Frb via fpc-devel
On 20/05/2021 19:00, Martin Frb via fpc-devel wrote: I would therefore expect (target depended) that "u8inttype" may be aligned? Sorry, forget that part of my previous post. I somehow got to u8 => 8byte => qword, instead of 8bit => Byte ___ fpc