[Issue 9142] New: Segmentation fault (DMD only) when calling some external functions twice in one expression
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 11 10:57:31 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9142
Summary: Segmentation fault (DMD only) when calling some
external functions twice in one expression
Product: D
Version: D2
Platform: x86_64
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: maximzms at gmail.com
--- Comment #0 from Maksim Zholudev <maximzms at gmail.com> 2012-12-11 10:57:27 PST ---
When I call some GSL functions from a D program this causes segmentation fault.
This happens:
at least with gsl_sf_sin and gsl_sf_cos;
only if compiled with DMD (no error with GDC);
only if the functions a called twice in the same arithmetic expression;
not for all argument values (1e-4 is OK, 2e-4 is not).
Order of operands matters if "bad" and "good" argument values are combined in
the same expression.
Wrapping of functions does not help.
Code:
----------
import std.stdio;
extern(C) double gsl_sf_sin(double x);
void main()
{
writeln(gsl_sf_sin(2e-4) + gsl_sf_sin(1e-4));
double a = gsl_sf_sin(1e-4);
writeln(a + gsl_sf_sin(2e-4));
writeln(gsl_sf_sin(1e-4) + gsl_sf_sin(2e-4)); //ERROR
}
----------
With DMD v2.060:
dmd test.d -L-lgsl -L-lblas
0.0003
0.0003
Segmentation fault
With GDC-4.6:
gdc-4.6 test.d -lgsl -lblas
0.0003
0.0003
0.0003
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list