1
0
mirror of https://github.com/golang/go synced 2024-11-25 02:57:57 -07:00

gc: handle complex CONVNOP

Fixes #2256.

R=ken2
CC=golang-dev
https://golang.org/cl/5044047
This commit is contained in:
Russ Cox 2011-09-19 11:50:53 -04:00
parent f554c90cef
commit ad7dea1e96
2 changed files with 15 additions and 0 deletions

View File

@ -133,6 +133,9 @@ complexgen(Node *n, Node *res)
dump("\ncomplexgen-n", n);
dump("complexgen-res", res);
}
while(n->op == OCONVNOP)
n = n->left;
// pick off float/complex opcodes
switch(n->op) {

View File

@ -105,4 +105,16 @@ func main() {
println("opcode x", ce, Ce)
panic("fail")
}
r32 := real(complex64(ce))
if r32 != float32(real(Ce)) {
println("real(complex64(ce))", r32, real(Ce))
panic("fail")
}
r64 := real(complex128(ce))
if r64 != real(Ce) {
println("real(complex128(ce))", r64, real(Ce))
panic("fail")
}
}