D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8218 - shared library segmentation fault when missing un-needed import
Summary: shared library segmentation fault when missing un-needed import
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All Mac OS X
: P2 major
Assignee: No Owner
URL:
Keywords: bootcamp, dll
Depends on:
Blocks:
 
Reported: 2012-06-11 01:36 UTC by thelastmammoth
Modified: 2024-12-13 18:00 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description thelastmammoth 2012-06-11 01:36:19 UTC
That sounds like a bug:

dmd -shared -oflibfun.dylib fun #WOULD WORK with -lib instead of -shared
dmd -g -L-L. main  
./main #SEGFAULTS... see lldb output below


//main.d:
import std.stdio;
pragma(lib,"fun");
void main(){
	writeln();
}

//fun.d:
//import std.stdio; //UNCOMMENT THIS LINE TO MAKE IT WORK ...
extern(C)
int parse(int x){return x;}

--------------------------------
output of lldb:
Process 64987 stopped
* thread #1: tid = 0x1f03, 0x0000000100000e3a main`D3std5stdio12__T7writelnZ7writelnFZv + 14 at stdio.d:1567, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000100000e3a main`D3std5stdio12__T7writelnZ7writelnFZv + 14 at stdio.d:1567
   1564	{
   1565	    static if (T.length == 0)
   1566	    {
-> 1567	        enforce(fputc('\n', .stdout.p.handle) == '\n');
   1568	    }
   1569	    else static if (T.length == 1 &&
   1570	                    isSomeString!(typeof(args[0])) &&
(lldb) bt
* thread #1: tid = 0x1f03, 0x0000000100000e3a main`D3std5stdio12__T7writelnZ7writelnFZv + 14 at stdio.d:1567, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000100000e3a main`D3std5stdio12__T7writelnZ7writelnFZv + 14 at stdio.d:1567
    frame #1: 0x0000000100000e25 main`_Dmain + 9 at main.d:5
    frame #2: 0x0000000100011915 main`D2rt6dmain24mainUiPPaZi7runMainMFZv + 29
    frame #3: 0x00000001000112ca main`D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 38
    frame #4: 0x0000000100011962 main`D2rt6dmain24mainUiPPaZi6runAllMFZv + 58
    frame #5: 0x00000001000112ca main`D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 38
    frame #6: 0x0000000100011255 main`main + 237
    frame #7: 0x0000000100000e14 main`start + 52
Comment 1 dlangBugzillaToGithub 2024-12-13 18:00:24 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18447

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB