Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(948)

Unified Diff: src/cmd/gc/walk.c

Issue 8174047: code review 8174047: cmd/gc: do not reuse bool temporaries for composite equ... (Closed)
Patch Set: diff -r 61d4b778498f https://go.googlecode.com/hg/ Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/fixedbugs/issue5162.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/gc/walk.c
===================================================================
--- a/src/cmd/gc/walk.c
+++ b/src/cmd/gc/walk.c
@@ -2856,11 +2856,19 @@
typecheck(&call, Etop);
walkstmt(&call);
*init = list(*init, call);
-
- if(n->op == OEQ)
- r = tempbool;
- else
- r = nod(ONOT, tempbool, N);
+
+ // tempbool cannot be used directly as multiple comparison
+ // expressions may exist in the same statement. Create another
+ // temporary to hold the value (its address is not taken so it can
+ // be optimized away).
+ r = temp(types[TBOOL]);
+ a = nod(OAS, r, tempbool);
+ typecheck(&a, Etop);
+ walkstmt(&a);
+ *init = list(*init, a);
+
+ if(n->op != OEQ)
+ r = nod(ONOT, r, N);
typecheck(&r, Erv);
walkexpr(&r, init);
*np = r;
« no previous file with comments | « no previous file | test/fixedbugs/issue5162.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b