www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19265] New: Multiple calls to rt_init/rt_term leads to SIGILL


          Issue ID: 19265
           Summary: Multiple calls to rt_init/rt_term leads to SIGILL in
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: chalucha gmail.com

I'm playing with fork() with druntime initialized after the fork, but I found
that I can't call rt_init/rt_term to cleanup the runtime multiple times.

Simple test case:

extern extern(C) int _d_run_main(int, char**, void*);
extern (C) int rt_init();
extern (C) int rt_term();

extern(C) int main(int argc, char** argv)
        auto res = _d_run_main(argc, argv, &testmain);
        res = _d_run_main(argc, argv, &testmain);
        return res;

int testmain(string[] args)
        return 1;


int(char[][]) function).runAll() ()

int(char[][]) function).tryExec(scope void() delegate) ()

Is this the expected behavior?

I guess that the problem is at least here:

Tried with dmd-2.082.0

Sep 25 2018