Consider the code:

record R
{
  class C
  {
    proc ~C()
    {
      writeln("in ~C");
    }
  }
  var c : C;

  proc R()
  {
    c = new C();
  }

  proc ~R()
  {
    writeln("in ~R");
    delete c;
  }
}

proc doit() {
  var x: R;
}

doit();

Description:
Expected behaviour should be that, x calls destructor once when leaving
scope. But for some reason the destructor is called at least twice:

in ~R
in ~C
in ~R
in ~C
bug1.chpl:3: error: attempt to dereference nil

While (in case when 'class C') isn't nested:

in ~R
in ~C

Also, changing record to class and calling all destructors manually doesn't
give this behaviour.

All the info you probably won't need:

Chapel Compiler built from github, commit:
10709f78f56888b68d6cb1489585bb12d44627c4

printchplenv:
machine info: Linux goovie-U36SG 3.13.0-37-generic #64-Ubuntu SMP Mon Sep
22 21:28:38 UTC 2014 x86_64
CHPL_HOME:  *
script location: /home/goovie/Dokumenty/Programowanie/chapel/util
CHPL_TARGET_PLATFORM: linux64
CHPL_TARGET_COMPILER: gnu
CHPL_TARGET_ARCH: native
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none
CHPL_TASKS: qthreads
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_MEM: jemalloc
CHPL_MAKE: make
CHPL_ATOMICS: intrinsics
CHPL_GMP: gmp
CHPL_HWLOC: hwloc
CHPL_REGEXP: none
CHPL_WIDE_POINTERS: struct
CHPL_AUX_FILESYS: none

backend C compiler: gcc 4.8.4
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
Chapel-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-bugs

Reply via email to