[Issue 16594] New: module destructors called again if an exception got thrown earlier
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Oct 4 16:10:04 PDT 2016
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 at puremagic.com
Reporter: code at 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 at 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
----
--
More information about the Digitalmars-d-bugs
mailing list