digitalmars.D.bugs - [Issue 6308] New: Destruction of temporaries on exception causes segfault
- d-bugmail puremagic.com (30/30) Jul 13 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (16/16) Jul 15 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (23/23) Jul 15 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (10/10) Jul 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (8/8) Jul 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (24/25) Jul 25 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (12/12) Jul 25 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (16/16) Aug 13 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (8/8) Aug 13 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (11/11) Aug 14 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (10/10) Aug 25 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (66/66) Aug 26 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (10/13) Sep 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (7/14) Sep 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
- d-bugmail puremagic.com (9/19) Sep 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6308
http://d.puremagic.com/issues/show_bug.cgi?id=6308 Summary: Destruction of temporaries on exception causes segfault Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: wrong-code Severity: major Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: thecybershadow gmail.com --- Comment #0 from Vladimir Panteleev <thecybershadow gmail.com> 2011-07-13 17:52:12 PDT --- My reply about this issue on dmd-beta is pending moderation, but a bug about this should probably be filed anyway. import std.stdio; void main() { foreach (i; 0..100) foreach (line; File("test.d").byLine) {} } On Windows, when the above program is compiled with DMD from current git and ran, it crashes with an unhandled exception (Windows displays two standard "has stopped working" dialogs in succession). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 13 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com --- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2011-07-15 10:27:29 PDT --- More by Vladimir: I did a bit of research on this a few days ago. Using a certain debugger and the map file, I found that the crash occurred in the autogenerated scope(exit) for getDependencies - the block of code that calls the File destructor. I didn't look too closely, but it looked like a bad "this" pointer is passed to the File dtor. I tried a full DMD/Phobos regression test, but didn't really get anywhere. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 15 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 --- Comment #2 from Vladimir Panteleev <thecybershadow gmail.com> 2011-07-15 21:48:28 PDT --- Minimized testcase: struct C { this(int) { throw new Exception("Oops!"); } ~this() { } int bar() { return 1; } } void foo(int) {} void main() { foo(C(1).bar()); } The key finding is that the exception is thrown in the constructor. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 15 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 Vladimir Panteleev <thecybershadow gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com --- Comment #3 from Vladimir Panteleev <thecybershadow gmail.com> 2011-07-21 16:29:13 PDT --- *** Issue 6329 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 21 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 --- Comment #4 from Vladimir Panteleev <thecybershadow gmail.com> 2011-07-21 16:32:01 PDT --- Issue 6329 is an example where the the exception isn't thrown in the constructor, but in the body of a delegate (dirEntries uses opApply). I'll try to minimize it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 21 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 --- Comment #5 from Vladimir Panteleev <thecybershadow gmail.com> 2011-07-25 23:26:22 PDT --- (In reply to comment #4)I'll try to minimize it.Reduced it to a small variation of the above. struct C { void oops() { throw new Exception("Oops!"); } ~this() { } } void main() { C().oops(); } I think DustMite may have taken some shortcuts while reducing Andrej's test case, though - but this test case definitely does show that it's not about throwing in a constructor. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 25 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 Vladimir Panteleev <thecybershadow gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Destruction of temporaries |Destruction of temporaries |on exception causes |on exception causes |segfault |unhandled access violation --- Comment #6 from Vladimir Panteleev <thecybershadow gmail.com> 2011-07-25 23:28:29 PDT --- By the way, I should probably clearly mention that this is Windows-only. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 25 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 Rainer Schuetze <r.sagitario gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |r.sagitario gmx.de --- Comment #7 from Rainer Schuetze <r.sagitario gmx.de> 2011-08-13 13:55:58 PDT --- I had a quick look at the disassembly generated for the code in comment 5, and it turns out that the frame handler pointer is zero, instead of identical code "C c; c.oops();" that generates something like mov edx,dword ptr fs:[0] push offset __Dmain+77h // this is 0 for "C().oops();" push edx mov dword ptr fs:[0],esp -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 13 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 --- Comment #8 from Rainer Schuetze <r.sagitario gmx.de> 2011-08-13 14:13:28 PDT --- dmd 2.053 does not crash, but also does not create any exception handling code at all, while dmd 2.054+ seems to generate setup code for the exception frame, but no exception code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 13 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #9 from Walter Bright <bugzilla digitalmars.com> 2011-08-14 02:13:43 PDT --- https://github.com/D-Programming-Language/dmd/commit/c616b691793bbc710c88fc23a68c4731b6574529 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 14 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |soywiz gmail.com --- Comment #10 from Don <clugdbug yahoo.com.au> 2011-08-25 08:01:17 PDT --- *** Issue 6363 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 25 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 --- Comment #11 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2011-08-26 09:25:16 PDT --- This code: import std.file; void main() { string[] dirs; foreach (string dir; dirEntries(r"C:\", SpanMode.shallow)) { if (dir.isDir) dirs ~= dir; } } Compiled via DMD 2.055 commit cfab198ee186f6e69c364aaf4206434220d83204 (Aug 15), enters an infinite loop at runtime where exceptions are kept throwing: === Bypassed === std.file.FileException std\file.d(1156): C:\pagefile.sys: The process cannot access the file because it is being used by another process. ---------------- 42A540 42A3B7 402A7D 40206D 402950 40298F 40258B 45B855 45B7AC ---------------- object.Error: Access Violation ---------------- 42A540 42A3B7 402950 40298F 40258B 45B855 45B7AC ---------------- Bypasses std.file.FileException std\file.d(1156) object.Error: Access Violation ---------------- 42A540 42A3B7 402950 40298F 40258B 45B855 45B7AC ---------------- object.Error: Access Violation ---------------- 42A540 42A3B7 402950 40298F 40258B 45B855 45B7AC It seems after it tries to open the protected pagefile.sys it keeps rethrowing exceptions and not exiting the foreach loop. It doesn't stop at all, just keeps rethrowing. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 26 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 --- Comment #12 from Vladimir Panteleev <thecybershadow gmail.com> 2011-09-08 03:22:49 PDT --- (In reply to comment #11)It seems after it tries to open the protected pagefile.sys it keeps rethrowing exceptions and not exiting the foreach loop. It doesn't stop at all, just keeps rethrowing.I can't reproduce this, it throws a single exception for me. Was this fixed in the meantime? The fact that you can't list C:\ because Phobos can't read a file's attributes is worth a separate bug report, though. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 08 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 --- Comment #13 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2011-09-08 07:48:16 PDT --- (In reply to comment #12)(In reply to comment #11)The final 2.055 release still has this issue, just checked. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------It seems after it tries to open the protected pagefile.sys it keeps rethrowing exceptions and not exiting the foreach loop. It doesn't stop at all, just keeps rethrowing.I can't reproduce this, it throws a single exception for me. Was this fixed in the meantime?
Sep 08 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6308 --- Comment #14 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2011-09-08 09:16:03 PDT --- (In reply to comment #13)(In reply to comment #12)Note that my bug6329 which was labeled as duplicate of this has a similar issue. First I get a range violation, then `object.Error: Access Violation` is printed many times before the app exits. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------(In reply to comment #11)The final 2.055 release still has this issue, just checked.It seems after it tries to open the protected pagefile.sys it keeps rethrowing exceptions and not exiting the foreach loop. It doesn't stop at all, just keeps rethrowing.I can't reproduce this, it throws a single exception for me. Was this fixed in the meantime?
Sep 08 2011