]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix typechecking of untyped boolean expressions
authorMatthew Dempsky <mdempsky@google.com>
Wed, 14 Feb 2018 22:08:17 +0000 (14:08 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 15 Feb 2018 01:00:06 +0000 (01:00 +0000)
commitd3f6d11d845fafe849d33505194b3ea1787e73a8
tree193598aca8a3980d5518aca801bcc765e4d8fc34
parentbcb563f4db2ce78be114689258c6a42201543bc5
cmd/compile: fix typechecking of untyped boolean expressions

Previously, if we typechecked a statement like

    var x bool = p1.f == p2.f && p1.g == p2.g

we would correctly update the '&&' node's type from 'untyped bool' to
'bool', but the '==' nodes would stay 'untyped bool'. This is
inconsistent, and caused consistency checks during walk to fail.

This CL doesn't pass toolstash because it seems to slightly affect the
register allocator's heuristics. (Presumably 'untyped bool's were
previously making it all the way through SSA?)

Fixes #23414.

Change-Id: Ia85f8cfc69b5ba35dfeb157f4edf57612ecc3285
Reviewed-on: https://go-review.googlesource.com/94022
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/const.go
test/fixedbugs/issue23414.go [new file with mode: 0644]