digitalmars.D.bugs - [Issue 5305] New: intrinsic functions have safe stripped of them in release mode.
- d-bugmail puremagic.com (22/22) Dec 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5305
- d-bugmail puremagic.com (24/24) Jan 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5305
- d-bugmail puremagic.com (18/18) Jan 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5305
- d-bugmail puremagic.com (13/19) Jan 21 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5305
http://d.puremagic.com/issues/show_bug.cgi?id=5305 Summary: intrinsic functions have safe stripped of them in release mode. Product: D Version: unspecified Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: blood.of.life gmail.com 16:50:30 PST --- https://gist.github.com/724508 The code snippet compiles with -release, but not without. In -release mode, the maths intrinsics have the mangling for safe removed ('Nf'), and so the linker chokes on the mangled signature (because libphobos2.a was compiled with -release.) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5305 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com 12:17:17 PST --- For convenience, here's the example: import std.math; T[] map(T, V)(T function(T) f, V[] list) { T[] result = new T[](list.length); foreach(k, v; list) { result[k] = f(v); } return result; } void main() { assert (map!(real, float) (&sqrt, [4.0f, 9.0f]) == [2.0f, 3.0f]); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 20 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5305 12:33:25 PST --- A reduced test case: import std.math; void map(real function(real) f) { } void main() { map(&sqrt); } What is happening here is that sqrt() is an intrinsic, it doesn't actually exist in the libphobos2.a. When compiled with -release, the assert() goes away, and sqrt is never referenced, hence no error. Without -release, the linker looks for std.math.sqrt, and can't find it because it's an intrinsic. The solution is one of: 1. have the compiler complain about attempts to take the address of an intrinsic 2. add a library version of the intrinsic -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 20 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5305 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.ccThe solution is one of: 1. have the compiler complain about attempts to take the address of an intrinsic 2. add a library version of the intrinsicIs it possible for the D compiler to use the intrinsic in most cases when sqrt is used directly, and give the pointer to a library sqrt when the programmer uses a &sqrt? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 21 2012