[Issue 9438] Strange RefCounted stack overflow

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 1 08:26:37 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9438



--- Comment #2 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-02-01 08:25:53 PST ---
Oh, it depends on compiler switches. Reduced from previous by combining B and
C:

import std.container, std.stdio, std.typecons, std.exception;

struct S
{
  RefCounted!int _data;

  int get() @property
  {
      writeln("here");
      enforce(_data.refCountedStore.isInitialized); //OH NOES!!!
      writeln("there");
      return _data.refCountedPayload;
  }
}

void main()
{
      S s;
      writeln(s.get).collectException();
        writeln(S().get);    
}

When compiling with -g, it prints "here", "here" and enforcement failure,
without -g it segfaults as like above. Since valgrind does not detect for -g
version memory errors, the issue may be dmd codegen bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list