← Back to index
|
Original Bugzilla link
Bug 574 – DMD uses D calling convention for returning complex floats from functions with C calling convention
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2006-11-19T16:44:00Z
Last change time
2014-02-15T13:20:01Z
Keywords
wrong-code
Assigned to
bugzilla
Creator
thomas-dloop
Comments
Comment #0
by thomas-dloop — 2006-11-19T16:44:29Z
DMD uses D calling convention for returning complex floats from functions with C calling convention. complex_d.d : # # extern(C){ # cfloat test_cfloat(cfloat); # cdouble test_cdouble(cdouble); # creal test_creal(creal); # } # # import std.stdio; # void main(){ # writefln("cfloat: %s\t(5+2i)", test_cfloat(2 + 1i)); # writefln("cdouble: %s\t(4+6i)", test_cdouble(1 + 2i)); # writefln("creal: %s\t(16+5i)", test_creal(3 + 1i)); # } # complex_c.c : # # float _Complex test_cfloat(float _Complex a){ # return a * 2 + 1; # } # # double _Complex test_cdouble(double _Complex a){ # return a * 3 + 1; # } # # long double _Complex test_creal(long double _Complex a){ # return a * 5 + 1; # } # gcc -m32 -c complex_c.c && dmd complex_c.o complex_d.d -ofcomplex && ./complex output: > cfloat: nan+nani (5+2i) > Segmentation fault expected output: > cfloat: 5+2i (5+2i) > cdouble: 4+6i (4+6i) > creal: 16+5i (16+5i)
Comment #1
by bugzilla — 2006-12-08T02:56:01Z
Fixed DMD 0.176