[Issue 5305] intrinsic functions have @safe stripped of them in release mode.
https://issues.dlang.org/show_bug.cgi?id=5305 Walter Brightchanged: What|Removed |Added Keywords||pull --
[Issue 5305] intrinsic functions have @safe stripped of them in release mode.
https://issues.dlang.org/show_bug.cgi?id=5305 --- Comment #4 from Walter Bright--- Works with the current version of DMD. Adding a test case: https://github.com/dlang/dmd/pull/5845 --
[Issue 5305] intrinsic functions have @safe stripped of them in release mode.
https://issues.dlang.org/show_bug.cgi?id=5305 hst...@quickfur.ath.cx changed: What|Removed |Added Keywords||safe CC||hst...@quickfur.ath.cx --
[Issue 5305] intrinsic functions have @safe stripped of them in release mode.
http://d.puremagic.com/issues/show_bug.cgi?id=5305 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #3 from bearophile_h...@eml.cc 2012-01-21 18:50:09 PST --- (In reply to comment #2) 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 Is 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: ---
[Issue 5305] intrinsic functions have @safe stripped of them in release mode.
http://d.puremagic.com/issues/show_bug.cgi?id=5305 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added CC||bugzi...@digitalmars.com --- Comment #1 from Walter Bright bugzi...@digitalmars.com 2012-01-20 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: ---
[Issue 5305] intrinsic functions have @safe stripped of them in release mode.
http://d.puremagic.com/issues/show_bug.cgi?id=5305 --- Comment #2 from Walter Bright bugzi...@digitalmars.com 2012-01-20 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: ---