[Bug 206] New: Wrong gcc5 __builtin_OPNAME_overflow signatures.
via D.gnu
d.gnu at puremagic.com
Fri Jan 8 21:51:11 PST 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=206
Bug ID: 206
Summary: Wrong gcc5 __builtin_OPNAME_overflow signatures.
Product: GDC
Version: development
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Normal
Component: gdc
Assignee: ibuclaw at gdcproject.org
Reporter: art.08.09 at gmail.com
For example:
> import gcc.builtins;
> pragma(msg, typeof(__builtin_add_overflow));
->
pure nothrow @nogc @safe extern (C) bool()
Which makes them unusable from D.
---------------------------------------------
void bug() {
int r;
__builtin_add_overflow(1, 2, &r);
}
---------------------------------------------
->
error: function gcc.builtins.__builtin_add_overflow () is not callable using
argument types (int, int, int*)
They do work if the type is overridden; ie this hack works:
@trusted bool overflow(string OP, A, B, R)(A a, B b, R* r) {
import gcc.builtins;
auto baofp = cast(typeof(&overflow))&mixin("__builtin_"~OP~"_overflow");
return (*baofp)(a, b, r);
}
if (overflow!"add"(a, b, &r))
error();
--
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20160109/63322d23/attachment.html>
More information about the D.gnu
mailing list