[fpc-devel] Dynamic Arrays as Static class variables

2010-10-04 Thread 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


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Dynamic Arrays as Static class variables

2010-10-04 Thread Willibald Krenn

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  0x00404b55 in fpc_finalize (DATA=0x16b9af, TYPEINFO=0x0)
at C:/source/fpcsrc/rtl/inc/rtti.inc:174
#2  0x in ?? ()
(gdb)

Cheers,
 Willi
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Dynamic Arrays as Static class variables

2010-10-05 Thread Juha Manninen (gmail)
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.

Juha
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Dynamic Arrays as Static class variables

2010-10-05 Thread Johann Glaser
Hi!

Am Dienstag, den 05.10.2010, 10:50 +0300 schrieb Juha Manninen (gmail):
> 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


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Dynamic Arrays as Static class variables

2010-10-05 Thread Jonas Maebe


On 05 Oct 2010, at 11:38, Johann Glaser wrote:


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


Somebody else already did: http://bugs.freepascal.org/view.php?id=17546


Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel