Using Clang with D
Jacob Carlborg
doob at me.com
Thu Jan 26 01:29:39 PST 2012
I'm trying to port a simple example that uses Clang from C to D but for
some reason the D version results in a segmentation fault.
This is the C code:
http://pastebin.com/4B2JGz9n
This is the D code:
http://pastebin.com/XPBsSVup
The stacktrace from GDB looks like this:
(gdb) r
Starting program: /Users/jacob/development/d/dstep/bin/dstep NSObject.h
Reading symbols for shared libraries .+.. done
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000004
0x0000000100104139 in clang_formatDiagnostic ()
(gdb) bt
#0 0x0000000100104139 in clang_formatDiagnostic ()
#1 0x0000000100001648 in _Dmain ()
#2 0x000000010001baa5 in D2rt6dmain24mainUiPPaZi7runMainMFZv ()
#3 0x000000010001b671 in D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv ()
#4 0x000000010001baf7 in D2rt6dmain24mainUiPPaZi6runAllMFZv ()
#5 0x000000010001b671 in D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv ()
#6 0x000000010001b5f4 in main ()
I'm using DMD 2.057 on Mac OS X compiling as 64bit.
Any idea what I have done wrong?
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list