D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4568 - Segfault in program that writes an array
Summary: Segfault in program that writes an array
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Mac OS X
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-01 23:15 UTC by Jeffrey Yasskin
Modified: 2012-01-28 15:09 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jeffrey Yasskin 2010-08-01 23:15:25 UTC
$ 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 ()
Comment 1 Walter Bright 2012-01-28 15:09:33 UTC
Can't reproduce with dmd 2.058.