Bug 6772 – Cannot pass cfloat argument type to a function on x86_64

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2011-10-05T13:32:00Z
Last change time
2015-06-09T05:10:39Z
Keywords
wrong-code
Assigned to
nobody
Creator
grahamc001uk

Comments

Comment #0 by grahamc001uk — 2011-10-05T13:32:18Z
In the example below the function gets a different value for argument n than value passed cf. Argument type and size is OK, but value is wrong. Both D1 and D2 have this problem. Problem only present for 64 bit code. import std.stdio; void myfunc(cfloat n) { writefln("argument type is %s", typeof(n).stringof); writefln("n = 0x%X, sizeof = %d", *(cast(ulong*)&n), n.sizeof); writefln("real part %f, imag part %f", n.re, n.im); } void main() { cfloat cf; cf = 1.02f+3.04fi; writefln("cf = 0x%X, sizeof = %d", *(cast(ulong*)&cf), cf.sizeof); myfunc(cf); }
Comment #1 by bugzilla — 2012-11-14T23:47:10Z
This is working with the latest.