mirror of
https://github.com/golang/go
synced 2024-11-05 18:36:08 +00:00
gc: fix crash for nested complex division
R=ken2 CC=golang-dev https://golang.org/cl/1720043
This commit is contained in:
parent
6e83100ae5
commit
6d8b8101ea
2 changed files with 7 additions and 1 deletions
|
@ -184,6 +184,7 @@ complexgen(Node *n, Node *res)
|
||||||
case OINDEX:
|
case OINDEX:
|
||||||
case OIND:
|
case OIND:
|
||||||
case ONAME: // PHEAP or PPARAMREF var
|
case ONAME: // PHEAP or PPARAMREF var
|
||||||
|
case OCALLFUNC:
|
||||||
igen(n, &n1, res);
|
igen(n, &n1, res);
|
||||||
complexmove(&n1, res);
|
complexmove(&n1, res);
|
||||||
regfree(&n1);
|
regfree(&n1);
|
||||||
|
@ -245,7 +246,6 @@ complexgen(Node *n, Node *res)
|
||||||
case OMUL:
|
case OMUL:
|
||||||
complexmul(nl, nr, res);
|
complexmul(nl, nr, res);
|
||||||
break;
|
break;
|
||||||
// ODIV call a runtime function
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,4 +35,10 @@ func main() {
|
||||||
// real, imag, cmplx
|
// real, imag, cmplx
|
||||||
c3 := cmplx(real(c2)+3, imag(c2)-5) + c2
|
c3 := cmplx(real(c2)+3, imag(c2)-5) + c2
|
||||||
fmt.Printf("c = %G\n", c3)
|
fmt.Printf("c = %G\n", c3)
|
||||||
|
|
||||||
|
// compiler used to crash on nested divide
|
||||||
|
c4 := cmplx(real(c3/2), imag(c3/2))
|
||||||
|
if c4 != c3/2 {
|
||||||
|
fmt.Printf("c3 = %G != c4 = %G\n", c3, c4)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue