[fpc-devel] FPC 3.2.0RC1 released!
> if anyone wants to assign me one of the new bugs to fix that have been > raised since the RC was released, I'll be happy to take a look. > > Gareth aka. Kit Not special for this RC but some bugs: === 1) packages\winunits-base\src\wininet.pp Compilation error in -Mdelphiunicode: bad declaration of overloaded functions FindFirstUrlCacheEntry() FindNextUrlCacheEntry() with 'W' versions of arguments Must be equivalent to such with 'A' arguments. Line 2593: function FindFirstUrlCacheEntry(lpszUrlSearchPattern:LPCWSTR; lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW; var lpcbCacheEntryInfo:LongWord):HANDLE;stdcall;external WININETLIBNAME name 'FindFirstUrlCacheEntryW'; Line 2636: function FindFirstUrlCacheEntry(lpszUrlSearchPattern:LPCWSTR; lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW; var lpcbCacheEntryInfo:DWORD):HANDLE;stdcall;external WININETLIBNAME name 'FindFirstUrlCacheEntryW'; Line 2637: function FindNextUrlCacheEntry(hEnumHandle:HANDLE; lpNextCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW; var lpcbCacheEntryInfo:DWORD):BOOL;stdcall;external WININETLIBNAME name 'FindNextUrlCacheEntryW'; Line 2656: function FindFirstUrlCacheEntry(lpszUrlSearchPattern:LPCWSTR; var lpFirstCacheEntryInfo:INTERNET_CACHE_ENTRY_INFOW; lpcbCacheEntryInfo:LPDWORD):HANDLE;stdcall;external WININETLIBNAME name 'FindFirstUrlCacheEntryW'; Line 2657: function FindNextUrlCacheEntry(hEnumHandle:HANDLE; var lpNextCacheEntryInfo:INTERNET_CACHE_ENTRY_INFOW; lpcbCacheEntryInfo:LPDWORD):BOOL;stdcall;external WININETLIBNAME name 'FindNextUrlCacheEntryW'; === 2) rtl\win\wininc\struct.inc Members 'lData' of NEWCPLINFOA/NEWCPLINFOW have different types. I think both must be LONG_PTR. Member 'code' of NMHDR must have 'Integer' type, becouse constants, used here, are signed. This cause wrong comparison results or require explicit cast everywhere in user code. === 3) This bug still exists: https://lists.freepascal.org/pipermail/fpc-devel/2016-November/037539.html === 4) packages\pasjpeg\src\jconfig.inc There is explicit declaration of {$MODE DELPHI}, so 'pasjpeg' is incompatible with -Mdelphiunicode. Can be '{$ifndef UNICODE}{$MODE DELPHI}{$endif}' === Just question. Why NativeInt / NativeUInt declaration changed to strong aliases? To be new Delphi compatible? But this inconvenient in Delphi, and so in FPC. Old code become broken. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] FPC 3.2.0RC1 released!
> Please report as a bug. > > > Regards, > Sven > I don't have an account in bug tracker. I post here to get confirmation and opinion from other members. In hope that one, who can create bug reports, will do this. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2
I am using custom build of minimal FPC RTL and found possible bug. When unit 'system' (or some other?) compiled using -O2 (or higher) option in 'fpc.cfg', then application, compiled using this unit, increase memory usage every time BeginThread() function is called. This appears on FPC 3.2.0 and not happens in earlier versions. Tested on official FPC binary for Windows, target platform - 'win32'/'win64'. Here is complete test environment - minimal RTL sources, FPC executables and test project: http://dl.free.fr/ckmK7KVPX Steps to reproduce: 1) Unpack archive 2) Execute script 'FPC\src\make_RTL_32A.bat' to build RTL. Current 'FPC\fpc.cfg' contains -O2 option enabled 3) Execute script 'compile.bat' to build test project. 4) Execute 'test.exe', then run Windows 'Task Manager' to view used memory. Test project repeatedly creates thread with 500ms sleep. Every time thread created, memory used by 'test.exe' is increased Repeat steps 2-4 after comment out '-O2' option in 'FPC\fpc.cfg' or replacing FPC binary with provided 'FPC\ppc386 3.0.4 - WORK.exe' (or your own) - memory will remains stable. If you have configured own RTL compilation - here is just test project without FPC binaries and RTL sources: http://dl.free.fr/nHDbSOzOQ Just change FPC path's in 'compile.bat'. Please anyone confirm this behaviour. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2
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 optimizations when enabled in 'fpc.cfg', e.g: %FPC_COMMAND% -O- -Mobjfpc win32\sysinitpas.pp or %FPC_COMMAND% -OoNOREGVAR -Mobjfpc win32\sysinitpas.pp ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2
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_BINARY=%FPC_DIR%\bin\i386-win32\ppc386.exe set UNITS_DIR=%FPC_DIR%\units\i386-win32\* "%FPC_BINARY%" -Fu"%UNITS_DIR%" -O2 -Mobjfpc "sysinitpas.pp" === Here is test project that show bug: http://dl.free.fr/ckmK7KVPX Test project with full environment (compiler and minimal RTL): http://dl.free.fr/nHDbSOzOQ > 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/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 optimizations when enabled in 'fpc.cfg', >> e.g: >> >> %FPC_COMMAND% -O- -Mobjfpc win32\sysinitpas.pp >> >> or >> >> %FPC_COMMAND% -OoNOREGVAR -Mobjfpc win32\sysinitpas.pp >> ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2
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', 'systlsdir.inc'). Used version 3.2.2 RC1. If you have another - get sources for your version. Script 'compile.bat' compiles 'sysinitpas.pp' and then - test project 'test.pp'. See comments inside. 'test_bad.exe' shows growing memory consumption. > 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. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2
Thank you, i will try this. > 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 options -O. > No other options are required for Windows RTL. > > When RTL is properly compiled, even with -O2, your test program works without memory leaks. > > Yuriy Sydorov, > j...@cp-lab.com ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2
Unfortunately I tried it and this doesn't work. Problem only with 'sysinitpas.pp' unit. He is not depends on other RTL units, but linked into final executable by compiler. I suppose, compiler itself depends on internal layout of this unit. And a solution is to compile 'sysinitpas.pp' with the same options as 'ppc386.exe' was compiled, not RTL. See my previuos demo: http://dl.free.fr/ePtkQwgJJ > 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 options -O. > No other options are required for Windows RTL. > > When RTL is properly compiled, even with -O2, your test program works without memory leaks. > > Yuriy Sydorov, > j...@cp-lab.com > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2
> Hello, > > You have not read closely what I wrote before: Sorry, earlier I try your hint - and result was bad. Perhaps I did something wrong. But I repeat it now - and it is working. Thank you again. Finally my working build script look like this: set UNITS_PATH=.\packages\* set UNITS_PATH=.\objpas;.\objpas\*;.\inc;.\win;%UNITS_PATH%;.\win32 set INC_PATH=.\inc;.\objpas;.\objpas\*;.\win;.\win\wininc;.\i386;.\win32 set OUTPUT_PATH=..\units32a set FPC_COMMAND=..\ppc386.exe -n -O3 -Twin32 -FU%OUTPUT_PATH% -Fu%UNITS_PATH% -Fi%INC_PATH% %FPC_COMMAND% -Us win32\system.pp %FPC_COMMAND% win32\classes.pp %FPC_COMMAND% packages\rtl-extra\winsock.pp %FPC_COMMAND% packages\winunits-base\comobj.pp %FPC_COMMAND% packages\winunits-base\shellapi.pp %FPC_COMMAND% packages\winunits-base\wininet.pp %FPC_COMMAND% win\messages.pp %FPC_COMMAND% packages\winunits-base\richedit.pp %FPC_COMMAND% packages\paszlib\paszlib.pas %FPC_COMMAND% inc\fpintres.pp %FPC_COMMAND% win32\sysinitpas.pp ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Different computation precision in 32-bit and 64-bit app
This code gives distinct results when compiled for Win32 and Win64 - Win32: 49744125 - Win64: 49744124.999 procedure Test; var D: Double; begin D := 3 * (exp(3 * ln(255))); WriteLn('Result: ' + FloatToStr(D)); end; Somewhere is precision loss (or extra rounding). Is this good? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel