Bug 14122 – GITHEAD -- Coner case regression with alias this and exceptions

Status
CLOSED
Resolution
INVALID
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-02-04T05:34:00Z
Last change time
2015-06-09T05:14:43Z
Assigned to
nobody
Creator
puneet

Comments

Comment #0 by puneet — 2015-02-04T05:34:59Z
I am getting errors with my application that runs fine with release 2.066.1 I do not know if the error is due to some race conditions in my code. While I am refactoring my code to avoid this issue, I am filing this issue since it could be a regression in DMD. I tried reducing, but am not able to reduce it more. So I am pasting the 60 line code that reproduces the regression. BTW, my original code is not this bad, much of ugliness in the snippet below arose while trying to reduce the issue. :-) /////////////// struct FOOW { FOO _foo; FOO foo() { return _foo; } alias foo this; this(FOO b) { _foo = b; } } struct FOO { Bar root; ~this() { if (root) { assert(refcou != 0); refcou--; } } this(this) { refcou++; } } uint refcou; Bar bar; class FooVec { FOO[] _foos; this() { for(int n ; n < 32 ; n++) _foos ~= FOO(bar); } FOO excp_loop(FooVec r) { for(size_t n; n < 32; ++n) excp(); FOOW p = FOO(bar); return p; } void excp() { int[][] llll ; try {auto vv = llll[0][0];} catch {} } } class Bar { this() {bar = this;} } void main() { import std.stdio; Bar bar = new Bar(); for (size_t i=0; i!=16; ++i) { auto vec = new FooVec(); vec.excp_loop(vec); writeln("Loop: ", i); } writeln("DONE"); }
Comment #1 by puneet — 2015-02-04T07:33:17Z
Closing this since it looks like dustmite took out a constructor and reduced the stuff to really a race condition. I will try to get to the real issue and file the bug again if required.
Comment #2 by puneet — 2015-02-05T03:36:16Z