gccgo: invalid error message for valid conversion to complex64
dvyukov opened this issue · comments
gccgo rejects the following program:
package a
var a = complex64(6)/774516156475830989403545856475830078125
go.go:2:22: error: complex real part overflow
This program is legal and should be compiled without error messages.
See Robert explanation in #11590.
gcc version 6.0.0 2015070 (experimental) (GCC)
Interesting. The mpfr library says that the value takes 130 bits to represent. But I agree that the value can be represented, inexactly, in float64. There is something wrong with the two occurrences of "max_exp = 128" (and probably also "max_exp = 1024") in expressions.cc.
I guess I'll close this for now since I find myself repeatedly looking at it. complex64
has real and imaginary parts with 32 bits each, not 64 bits each and sure enough, 774516156475830989403545856475830078125
does not fit into a float32
. Seems like gccgo probably does the right thing in this case.