I am using the dmd compiler and phobos library at version 2.055. This is on Linux Mint 11 with x86 architecture. To repeat the bug is a bit weird. It seems to only happen when using std.path.curdir, and only when not in the main module. The following will NOT produce the error: import std.path; import std.stdio; int main() { writeln(buildPath(curdir, "a.out")); return 0; } This WILL produce the error: -- main.d static import foobar; int main() { foobar.crash(); return 0; } -- foobar.d module foobar; import std.path; import std.stdio; void crash() { writeln(buildPath(curdir, "a.out")); } Compiling and running this results in a segfault. No idea why. Workaround that seems to work is to use std.path.curdir.idup instead.
As of dmd 2.056, this now throws "core.exception.OutOfMemoryError". No recompilation was needed, but recompilation resulted in the same thing. This is probably some error in druntime.
I am using the latest revisions of DMD, druntime and Phobos, and I can't reproduce this. curdir is a string enum, and the only thing that happens to it in buildPath is the following: return cast(string)(curdir ~ dirSeparator ~ "a.out"); This should be perfectly OK, as concatenation always allocates a new string. Therefore, I agree with Jacob that it is/was a bug in druntime, or perhaps DMD, but it seems to have been fixed now.
(In reply to comment #2) > Therefore, I agree with Jacob [...] Why on earth did I say Jacob? :) I meant Jonathan, of course.
Lars, for completeness, can you give your OS/architecture? As I said, it still happens on x86 Linux for me.
I am on 64-bits Ubuntu Linux. However, I have tried compiling the entire toolchain (DMD, druntime and Phobos, all fresh from the Github repositories) with -m32, and used it to compile your test case, and I still can't reproduce it.
Have you tried this with DMD 2.057, and if so, are you still experiencing the same problem?
I think this one should be closed as "Can't reproduce". We'll reopen it if it happens again.
I agree.