digitalmars.D.bugs - [Issue 8152] New: Linking C library causes Seg-fault
- d-bugmail puremagic.com (38/38) May 26 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8152
- d-bugmail puremagic.com (11/11) May 26 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8152
- d-bugmail puremagic.com (10/10) May 31 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8152
- d-bugmail puremagic.com (9/10) Jul 03 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8152
- d-bugmail puremagic.com (13/13) Jan 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8152
http://d.puremagic.com/issues/show_bug.cgi?id=8152 Summary: Linking C library causes Seg-fault Product: D Version: D2 Platform: x86_64 OS/Version: Mac OS X Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: stephan.schiffels mac.com --- The following program tries to trivially run a function from the GSL. It compiles, but generates a segmentation fault when run. gsltest.d -------------------------- import std.stdio; extern (C) double gsl_sf_hyperg_2F1(double a, double b, double c, double x); void main() { double f = 0.0025; auto ret = f * gsl_sf_hyperg_2F1(1.0, 10.0, 11.0, 1.0 - f / 0.025); writeln(ret); } --------------------------- The program should return 0.015681, which is the numerically correct result. Note that the bug can not be in the GSL itself, as it works correctly when used with C or C++. To compile and run the code, I used the following command line: rdmd -L-L/opt/local/lib -L-lgsl -L-lgslcblas gsltest.d (assuming that gel libraries are in /opt/local/lib) This seems to be a bug related to how C library functions are called from D. Stephan -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 26 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8152 --- I ran the executable through the GNU debugger. Here is the output: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: 13 at address: 0x0000000000000000 0x00007fff912a86cd in misaligned_stack_error_entering_dyld_stub_binder () And most peculiar by the way: If I drop the variable f, but simply put 0.025 directly in front of the function, the program does NOT crash... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 26 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8152 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au Related to bug 5570? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 31 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8152 ---Related to bug 5570?That may well be. I am unable to check how things compare between 32 and 64 bits, though. Stephan -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 03 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8152 Stephan <stephan.schiffels mac.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- This issue is resolved. Tested on dmd 2.061. Thanks for fixing! Stephan -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 22 2013