[Issue 15514] Segfault when calling valid D code from C

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jan 4 13:15:01 PST 2016


https://issues.dlang.org/show_bug.cgi?id=15514

ag0aep6g at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #2 from ag0aep6g at gmail.com ---
Reduced the test case a little:

main.c:
----
extern void initialize();

int main(int argc, char*argv[]) {
  initialize();
  return 0;
}
----

foo.d:
----
extern(C) void initialize() {
  import core.runtime;  
  Runtime.initialize;
  int x;
  auto dg = {x = 2;};
  Runtime.terminate();
}
----

Compiling and running:
----
$ gcc -c main.c
$ dmd foo.d main.o
$ ./foo
Segmentation fault (core dumped)
----

--


More information about the Digitalmars-d-bugs mailing list