www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - gdc compiled program seg fault

I'm having trouble getting a trivial d program working properly. I'm trying
with gdc both with the prebuild binaries downloaded from
http://downloads.sourceforge.net/dgcc/gdc-0.24-x86_64-linux-gnu-gcc-4.1.2.tar.bz2?modtime=1187745544&big_mirror=0
and with a version I built myself. I installed the prebuilt one in /usr/local.
For the one I built, I specified d version 2, a prefix in my home dir and
static and no shared options to allow it compile. I'm on fedora 9.

gdc compiles the program fine and it runs. As long as I enter words, it echos
them back. But when I hit ctrl + d to signal eof, it seg faults.

$ cat test.d
import std.stdio;

int main()
{
        char[] buf;
        while ((buf = readln()) != null)
                writef("%s", buf);
        return 0;
}

$ gdc -Wall -g test.d -o test

$ ./test
hello
hello
<I typed ctrl + d here.>
Segmentation fault

$ gdb ./test
GNU gdb Fedora (6.8-12.fc9)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...
(gdb) r
Starting program: /data/Documents/Eclipse Workspace/Simple D Kernel/test
[Thread debugging using libthread_db enabled]
foo
foo
<I typed ctrl + d here.>
[New Thread 0x7fe4bf3e36f0 (LWP 18639)]

Program received signal SIGSEGV, Segmentation fault.
0x0000003568283b8b in memcpy () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc.x86_64
(gdb) bt










I'm not sure if this is the right place to report this. If somewhere else is
better, please let me know where.

Thanks,
Dan
Aug 01 2008