Bug 4568 – Segfault in program that writes an array
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2010-08-01T23:15:00Z
Last change time
2012-01-28T15:09:33Z
Assigned to
nobody
Creator
jyasskin
Comments
Comment #0 by jyasskin — 2010-08-01T23:15:25Z
$ cat test.d
import std.stdio;
void main(string[] args) {
std.stdio.writeln(args);
}
$ dmd test.d
$ ./test
Segmentation fault
$ ./test|cat
$ uname -a
Darwin jyasskin-macbookpro.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 i386 MacBookPro2,2 Darwin
$ dmd --help
Digital Mars D Compiler v2.047
...
The segfault is weird in that it goes away when stdout is redirected through cat. The expected output still doesn't appear though. gdb reports:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x00000000
0x0000ad3d in __tls_get_addr ()
(gdb) bt
#0 0x0000ad3d in __tls_get_addr ()
#1 0x000078f9 in _moduleTlsCtor ()
#2 0x0000760a in _moduleCtor ()
#3 0x0000ff70 in D2rt6dmain24mainUiPPaZi6runAllMFZv ()
#4 0x0000fe7e in D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv ()
#5 0x0000fe0c in main ()