Thread overview | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 14, 2011 [Issue 6308] New: Destruction of temporaries on exception causes segfault | ||||
---|---|---|---|---|
| ||||
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: ------- |
July 15, 2011 [Issue 6308] Destruction of temporaries on exception causes segfault | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | 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: ------- |
July 16, 2011 [Issue 6308] Destruction of temporaries on exception causes segfault | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | 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: ------- |
July 21, 2011 [Issue 6308] Destruction of temporaries on exception causes segfault | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | 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: ------- |
July 21, 2011 [Issue 6308] Destruction of temporaries on exception causes segfault | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | 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: ------- |
July 26, 2011 [Issue 6308] Destruction of temporaries on exception causes segfault | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | 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: ------- |
July 26, 2011 [Issue 6308] Destruction of temporaries on exception causes unhandled access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | 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: ------- |
August 13, 2011 [Issue 6308] Destruction of temporaries on exception causes unhandled access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | 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: ------- |
August 13, 2011 [Issue 6308] Destruction of temporaries on exception causes unhandled access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | 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: ------- |
August 14, 2011 [Issue 6308] Destruction of temporaries on exception causes unhandled access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | 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: ------- |
Copyright © 1999-2021 by the D Language Foundation