[Issue 10789] Struct destructor erroneously called
http://d.puremagic.com/issues/show_bug.cgi?id=10789 S�nke Ludwig slud...@outerproduct.org changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | --- Comment #7 from S�nke Ludwig slud...@outerproduct.org 2013-09-29 04:38:40 PDT --- The original test case still fails on DMD HEAD: --- 0018FD74 this() 0 0018FD75 this(this) 1 0018FD74 ~this() 2 0018FD9C ~this() 1 core.exception.AssertError@app(47): Assertion failure --- This is due to the last destructor running on an uninitialized instance (initialized == false). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 10789] Struct destructor erroneously called
http://d.puremagic.com/issues/show_bug.cgi?id=10789 --- Comment #8 from Kenji Hara k.hara...@gmail.com 2013-09-29 08:36:03 PDT --- (In reply to comment #7) The original test case still fails on DMD HEAD: --- 0018FD74 this() 0 0018FD75 this(this) 1 0018FD74 ~this() 2 0018FD9C ~this() 1 core.exception.AssertError@app(47): Assertion failure --- This is due to the last destructor running on an uninitialized instance (initialized == false). To me it looks like that the original test case contains a bug. In S.this(this), `initialized` field is incorrectly set to false. It will stop to decrement S.count at the destruction of the copied objects. Therefore the last assertion in main fails because S.count == 1. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 10789] Struct destructor erroneously called
http://d.puremagic.com/issues/show_bug.cgi?id=10789 S�nke Ludwig slud...@outerproduct.org changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution||FIXED --- Comment #9 from S�nke Ludwig slud...@outerproduct.org 2013-09-29 09:20:09 PDT --- Sorry, you are absolutely right. The initialized = false was supposed to go to the destructor instead to test if the destructor is called twice on the same instance. I'm still seeing a similar issue in my project, but I can't reproduce it with the fixed this(this). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 10789] Struct destructor erroneously called
http://d.puremagic.com/issues/show_bug.cgi?id=10789 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||pull --- Comment #5 from Kenji Hara k.hara...@gmail.com 2013-09-03 21:45:29 PDT --- https://github.com/D-Programming-Language/dmd/pull/2523 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 10789] Struct destructor erroneously called
http://d.puremagic.com/issues/show_bug.cgi?id=10789 --- Comment #6 from github-bugzi...@puremagic.com 2013-09-03 22:53:21 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4ca445bb2564997b80d5c00c6dfc1daeff1e30af fix Issue 10789 - Struct destructor erroneously called https://github.com/D-Programming-Language/dmd/commit/cfffc9b02fed9366babb6712cba7d6f26c18df6e Merge pull request #2523 from 9rnsr/fix10789 [REG2.061] Issue 10789 - Struct destructor erroneously called -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 10789] Struct destructor erroneously called
http://d.puremagic.com/issues/show_bug.cgi?id=10789 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Status|NEW |RESOLVED CC||bugzi...@digitalmars.com Resolution||FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 10789] Struct destructor erroneously called
http://d.puremagic.com/issues/show_bug.cgi?id=10789 --- Comment #3 from S�nke Ludwig slud...@outerproduct.org 2013-08-17 07:31:21 PDT --- I digged a little in the DMD sources and found a commit by Kenji Hara that at least affects this example and has a commented out code block that looks a little suspicious : https://github.com/D-Programming-Language/dmd/commit/b4bc25d72e601436f3999abc5c9c31e464385052#L4R1241 Changing #if 0//DMDV2 back to #if DMDV2 inserts a proper postblit call, but then the returned t has its initialized field set to false. This does not happen with the #if 0 AFAICS. Unfortunately I know far to less about the mechanics at work there to make an informed attempt to fix this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 10789] Struct destructor erroneously called
http://d.puremagic.com/issues/show_bug.cgi?id=10789 Maxim Fomin ma...@maxim-fomin.ru changed: What|Removed |Added Severity|normal |regression --- Comment #4 from Maxim Fomin ma...@maxim-fomin.ru 2013-08-17 09:26:45 PDT --- (In reply to comment #3) I digged a little in the DMD sources and found a commit by Kenji Hara that at least affects this example and has a commented out code block that looks a little suspicious : https://github.com/D-Programming-Language/dmd/commit/b4bc25d72e601436f3999abc5c9c31e464385052#L4R1241 Changing #if 0//DMDV2 back to #if DMDV2 inserts a proper postblit call, but then the returned t has its initialized field set to false. This does not happen with the #if 0 AFAICS. Unfortunately I know far to less about the mechanics at work there to make an informed attempt to fix this. Sounds like a regression. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 10789] Struct destructor erroneously called
http://d.puremagic.com/issues/show_bug.cgi?id=10789 --- Comment #1 from S�nke Ludwig slud...@outerproduct.org 2013-08-09 22:55:04 PDT --- Created an attachment (id=1241) Reproduction case -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 10789] Struct destructor erroneously called
http://d.puremagic.com/issues/show_bug.cgi?id=10789 Maxim Fomin ma...@maxim-fomin.ru changed: What|Removed |Added CC||ma...@maxim-fomin.ru --- Comment #2 from Maxim Fomin ma...@maxim-fomin.ru 2013-08-10 00:44:27 PDT --- Reduced: extern(C) int printf(const char*, ...); struct S { static int count; this(int ignoreme) { int oldcount = count; printf(%X ctor %d=%d\n, this, oldcount, ++count); } ~this() { int oldcount = count; printf(%X dtor %d=%d\n, this, oldcount, --count); } this(this) { int oldcount = count; printf(%X postblit %d=%d\n, this, oldcount, ++count); } } S fun() { S s1 = S(42), s2 = S(24); if (true) return s1; else return s2; } void main() { S s = fun(); } In case of if(true) compiler does not insert postblit call. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---