-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/cgo: broken C.complexfloat and C.complexdouble support? #13402
Comments
The "float complex" and "double complex" in nameToC need to be __complex instead. Not sure about dwarfToName. Also probably the first case in the switch at line 1692 should check for dwarf.ComplexType as well. |
Looks like the DWARF names are "complex float" and "complex double" for both GCC and Clang, so the space stripping logic will map them to C.complexfloat and C.complexdouble even without any dwarfToName entries. |
Hm, fixing this leads to:
Apparently the status quo is cgo treats C.complexfloat and complex64 as equivalent (and similarly for C.complexdouble and complex128). Should we be worried that fixing this issue could break Go code that relies on this (seemingly erroneous) behavior? |
CL https://golang.org/cl/17208 mentions this issue. |
It does seem like people should need an explicit type conversion to the C type, so I think it's OK to make this change. Even if this were covered by the Go 1 guarantee, it is a bug fix. |
…e fix Updates #13402. Change-Id: Ia7b729d81fb78206d214444911f2e6573b88717a Reviewed-on: https://go-review.googlesource.com/17240 Reviewed-by: Ian Lance Taylor <iant@golang.org>
In cmd/cgo/gcc.go, I see there's code to support C.complexfloat and C.complexdouble, but it doesn't seem to work:
CC @ianlancetaylor
The text was updated successfully, but these errors were encountered: