[fpc-devel] Is this a bug?

Bart bartjunk64 at gmail.com
Wed Feb 27 17:24:46 CET 2019


Reported in forum:
http://forum.lazarus.freepascal.org/index.php/topic,44466.msg312583.html#msg312583

{$mode objfpc} //same in mode delphi, did not test others
procedure DoIt(ar: array of const);
begin
  try
    exit;
  finally

  end
end;

begin
   DoIt([]);
end.

C:\Users\Bart\LazarusProjecten\ConsoleProjecten>fpc -gh -gl -TWin64
-Px86_64 test.pas
Free Pascal Compiler version 3.3.1 [2019/02/27] for x86_64
...
C:\Users\Bart\LazarusProjecten\ConsoleProjecten>test
Marked memory at $00000000000BD9E0 released
Call trace for block at $00000000000BD9E0 size 0
  $000000010000581B  fpc_getmem,  line 362 of ../inc/heap.inc
  $0000000100001668  DOIT,  line 6 of test.pas
  $00000001000016E1  main,  line 15 of test.pas
  $00000001000016F6  MAIN_WRAPPER,  line 126 of system.pp
  $000000010000A6D0  EXE_ENTRY,  line 240 of system.pp
  $00000001000015F0  _FPC_MAINCRTSTARTUP,  line 106 of sysinit.pp
  $00007FFF523F3DC4
  $00007FFF525A3691
 was released at
freed again at
  $000000010000C31D  INTERNALFREEMEMSIZE,  line 712 of ../inc/heaptrc.pp
  $000000010000C5B4  TRACEFREEMEMSIZE,  line 768 of ../inc/heaptrc.pp
  $000000010000C676  TRACEFREEMEM,  line 808 of ../inc/heaptrc.pp
  $000000010000583B  fpc_freemem,  line 367 of ../inc/heap.inc
  $0000000100001622  fin$00000002,  line 12 of test.pas
  $00000001000016A0  DOIT,  line 6 of test.pas
  $00000001000016E1  main,  line 15 of test.pas
  $00000001000016F6  MAIN_WRAPPER,  line 126 of system.pp
Heap dump by heaptrc unit of
C:\Users\Bart\LazarusProjecten\ConsoleProjecten\test.exe
1057 memory blocks allocated : 136508/136560
1057 memory blocks freed     : 136508/136560
0 unfreed memory blocks : 0
True heap size : 196608 (192 used in System startup)
True free heap : 196416

(It also crashes if heaptrace is not used)
It crashes with 64-bit fpc 3.0.4 and trunk.
It does not crash with 32-bit fpc (3.0.4 or trunk) on Windows, nor
does it crash with fpc 3.0.4 64-bit on Linux.

-- 
Bart



More information about the fpc-devel mailing list