Commit 564a1f33 authored by Anthony Martin's avatar Anthony Martin

gc: fix string comparisons for new bool rules

The two string comparison optimizations were
missing the implicit cast from ideal bool.

Fixes #3119.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5696071
parent fc268acf
......@@ -1017,6 +1017,7 @@ walkexpr(Node **np, NodeList **init)
r = nod(n->etype, nod(OLEN, n->left, N), nod(OLEN, n->right, N));
typecheck(&r, Erv);
walkexpr(&r, init);
r->type = n->type;
n = r;
goto ret;
}
......@@ -1029,6 +1030,7 @@ walkexpr(Node **np, NodeList **init)
r = nod(n->etype, nod(OLEN, n->left->left, N), nodintconst(0));
typecheck(&r, Erv);
walkexpr(&r, init);
r->type = n->type;
n = r;
goto ret;
}
......
// compile
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// http://code.google.com/p/go/issues/detail?id=3119
package main
import "fmt"
func main() {
s := "hello"
fmt.Println(s == "")
fmt.Println(s + "world" == "world")
}
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