cat > bug.d << CODE
import std.net.curl;
void main()
{
auto http = HTTP("dlang.org/non-existing-url");
http.onReceiveStatusLine = (HTTP.StatusLine s) {
if (s.code != 200)
throw new Exception("Request failed.");
};
http.method = HTTP.Method.head;
http.perform();
}
CODE
dmd -L-lcurl -run bug
----
This program segfaults because the D exception handling cannot unwind through the C stack of libcurl. What's needed here is either a nothrow requirement on the callbacks or an exception catch/rethrow mechanism.
Comment #1 by bugzilla — 2019-12-17T08:48:25Z
I'm getting "[email protected](8): Request failed." Feel free to reopen, when the bug still exists on your computer.
Comment #2 by moonlightsentinel — 2019-12-17T11:50:14Z
Can reproduce it locally but only for 64-bit builds.
dmd -g -m64 -run bug.d segfaults but dmd -g -m32 -run bug.d prints the expected stack trace
Comment #3 by bugzilla — 2019-12-17T12:27:59Z
For me -m64 works and with -m32 I get a linker error: Scrt1.o cannot be found...
Comment #4 by moonlightsentinel — 2019-12-17T12:30:09Z
Wow. SHould've mentioned that this was tested on Win 10, 64 Bit with v2.089.0
Comment #5 by robert.schadek — 2024-12-01T16:22:38Z