Commit ad7dea1e authored by Russ Cox's avatar Russ Cox

gc: handle complex CONVNOP

Fixes #2256.

R=ken2
CC=golang-dev
https://golang.org/cl/5044047
parent f554c90c
...@@ -134,6 +134,9 @@ complexgen(Node *n, Node *res) ...@@ -134,6 +134,9 @@ complexgen(Node *n, Node *res)
dump("complexgen-res", res); dump("complexgen-res", res);
} }
while(n->op == OCONVNOP)
n = n->left;
// pick off float/complex opcodes // pick off float/complex opcodes
switch(n->op) { switch(n->op) {
case OCOMPLEX: case OCOMPLEX:
......
...@@ -105,4 +105,16 @@ func main() { ...@@ -105,4 +105,16 @@ func main() {
println("opcode x", ce, Ce) println("opcode x", ce, Ce)
panic("fail") 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")
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment