From: Ken Thompson Date: Fri, 21 May 2010 03:56:28 +0000 (-0700) Subject: fix bug 275 X-Git-Tag: weekly.2010-05-27~57 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=09b2de77b5a05baebd43406229bc56933a6e22a0;p=gostls13.git fix bug 275 R=rsc CC=golang-dev https://golang.org/cl/1198046 --- diff --git a/src/cmd/gc/cplx.c b/src/cmd/gc/cplx.c index a98cf49d8d..7da61c2471 100644 --- a/src/cmd/gc/cplx.c +++ b/src/cmd/gc/cplx.c @@ -129,12 +129,18 @@ complexgen(Node *n, Node *res) return; case OREAL: - subnode(&n1, &n2, n->left); - cgen(&n1, res); - return; - case OIMAG: - subnode(&n1, &n2, n->left); + nl = n->left; + if(!nl->addable) { + tempname(&tmp, nl->type); + complexgen(nl, &tmp); + nl = &tmp; + } + subnode(&n1, &n2, nl); + if(n->op == OREAL) { + cgen(&n1, res); + return; + } cgen(&n2, res); return; } diff --git a/test/golden.out b/test/golden.out index 22f2f98a61..1bed6599a8 100644 --- a/test/golden.out +++ b/test/golden.out @@ -180,7 +180,3 @@ BUG: bug260 failed =========== bugs/bug274.go BUG: errchk: command succeeded unexpectedly - -=========== bugs/bug275.go -bugs/bug275.go:17: internal compiler error: subnode not addable -BUG should compile