Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-10

Dynamic Arrays as Static class variables

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Johann Glaser

Hi!

It seems there is a problem with dynamic arrays which are defined as static variables in classes.

Type
  TTest = class
    FDynArr : Array of Integer; static;
  End;

When the class is Destroy()ed, the call to CleanupInstance, which calls fpc_finalize, does a fpc_dynarray_decr_ref which generates a SEGV. Did anybody else experience this problem (using FPC2.4.0-2 on a AMD64 machine). If not, I'll put a test case together.

Bye
Hansi

Reply by email

Willibald Krenn
to Johann Glaser

Hi,

I just tried and can reproduce this with fpc rev. 16078 on win64.

Running

{$mode objfpc}{$H+}
Type
   TTest = class
     FDynArr : Array of Integer; static;
   End;
var
  x : TTest;
begin
   x := TTest.Create();
   x.free;
end.

gives

Program received signal SIGSEGV, Segmentation fault. fpc_dynarray_decr_ref (P=0x40d01800, TI=0x14afa90) at C:/source/fpcsrc/rtl/inc/dynarr.inc:103
103 if realp^.refcount=0 then
(gdb) bt
#0 fpc_dynarray_decr_ref (P=0x40d01800, TI=0x14afa90) at C:/source/fpcsrc/rtl/inc/dynarr.inc:103
#1 0x0000000000404b55 in fpc_finalize (DATA=0x16b9af, TYPEINFO=0x0) at C:/source/fpcsrc/rtl/inc/rtti.inc:174
#2 0x0000000000000000 in ?? ()
(gdb)

Cheers,
Willi

Reply by email

Johann Glaser
to Juha Manninen (gmail

Hi!

Juha Manninen (gmail) wrote 6 lines
On Tuesday 05 October 2010 01:00:19 Willibald Krenn wrote: > Hi, > > I just tried and can reproduce this with fpc rev. 16078 on win64. Same thing here on Linux , AMD64, few days old FPC trunk version.

Thank you for trying and confirming. Should I submit a bug report?

Bye
Hansi

Reply by email