[Issue 821] New: segfault with char array copy
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 9 00:00:58 PST 2007
http://d.puremagic.com/issues/show_bug.cgi?id=821
Summary: segfault with char array copy
Product: D
Version: 1.00
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: ch at lathspell.de
Hello
I tried the example from the d homepage but it segfaults using both DMD and GDC
(in the binary versions that are linked from the homepage).
My host is a AMD Athlon64 running in i386 chroot using 'Debian sid'. Other D
programs run fine.
$ cat segfault.d
import std.stdio;
int main(char[][] args) {
char[] s1 = "hello world";
char[] s2 = "goodbye ";
s2[8..13] = s1[6..11]; // s2 is "goodbye world"
return 0;
}
$ ltrace ./segfault
...
calloc(1, 68) = 0x8061150
mmap(0, 0x100000, 3, 34, -1) = 0xf7d06000
calloc(2050, 4) = 0x8061198
calloc(2050, 4) = 0x80631a8
calloc(2050, 4) = 0x80651b8
malloc(256) = 0x80671c8
memset(0x80671c8, '\013', 256) = 0x80671c8
realloc(NULL, 4) = 0x80672d0
memmove(0x80672d4, 0x80672d0, 0, 0, 0x8061008) = 0x80672d4
memset(0x80671c8, '\n', 16) = 0x80671c8
pthread_mutex_lock(0x80610a8, 0x8061008, 0x1f35850, 0x8061008, 0x805ec58) = 0
calloc(2050, 4) = 0x80672e0
pthread_mutex_unlock(0x80610a8, 0x80672d8, 8200, 0x8061150, 0xf7d06ff0) = 0
pthread_mutex_lock(0x80610a8, 0x8061008, 0x80672d8, 0x8061008, 0x805f814) = 0
pthread_mutex_unlock(0x80610a8, 0x80610a8, 0x8061008, 0x80672d8, 0x8061008) = 0
pthread_attr_init(0xf7d07f20, 0x8061008, 0xffcd551c, 0x805959c, 0) = 0
pthread_mutex_init(0xf7d07f40, 0, 0x8061008, 0xffcd551c, 0x805959c) = 0
pthread_cond_init(0xf7d07f58, 0, 0x8061008, 0xffcd551c, 0x805959c) = 0
pthread_self(0x805ec58, 0x805b1c9, 0x805d2ec, 0x8061008, 1) = 0xf7e066c0
sigfillset(0xffcd553c) = 0
sigaction(10, 0xffcd5538, NULL) = 0
sigaction(12, 0xffcd5538, NULL) = 0
sem_init(0x8060ac8, 0, 0, 0x805b1c9, 0x805d2ec) = 0
malloc(8) = 0x80692f0
memset(0xf7d08f80, '\000', 124) = 0xf7d08f80
memset(0xf7d08f00, '\000', 124) = 0xf7d08f00
strlen("./segfault") = 10
memcpy(0x805a0bc, "world", 5 <unfinished ...>
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++
--
More information about the Digitalmars-d-bugs
mailing list