digitalmars.D.bugs - [Issue 16594] New: module destructors called again if an exception
- via Digitalmars-d-bugs (50/50) Oct 04 2016 https://issues.dlang.org/show_bug.cgi?id=16594
https://issues.dlang.org/show_bug.cgi?id=16594 Issue ID: 16594 Summary: module destructors called again if an exception got thrown earlier Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: major Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: code dawg.eu cat > bug.d << CODE import core.stdc.stdio; __gshared int count; shared static ~this() { printf("dtor call %d\n", ++count); if (count == 1) throw new Exception("dtor exception"); } CODE dmd -main -run bug ---- object.Exception bug.d(8): dtor exception ---------------- ??:? void bug._sharedStaticDtor1() [0x42792a] ??:? void bug.__modshareddtor() [0x427940] ??:? void rt.minfo.__T17runModuleFuncsRevS442rt5minfo11ModuleGroup8runDtorsMFZ9__lambda1Z.runModuleFuncsRev(const(immutable(object.ModuleInfo)*)[]) [0x42db3e] ??:? void rt.minfo.ModuleGroup.runDtors() [0x42d5ac] ??:? int rt.minfo.rt_moduleDtor().__foreachbody1(ref rt.sections_elf_shared.DSO) [0x42d8f3] ??:? int rt.sections_elf_shared.DSO.opApplyReverse(scope int delegate(ref rt.sections_elf_shared.DSO)) [0x42dcee] ??:? rt_moduleDtor [0x42d8d2] ??:? rt_term [0x42b27e] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x427fc8] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x427f48] ??:? _d_run_main [0x427eb9] ??:? main [0x427a4d] ??:? __libc_start_main [0xf6eef730] dtor call 1 dtor call 2 ---- --
Oct 04 2016