From 48f990b4a5743426ebf39b9cf2930fe100ebca9e Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Thu, 22 Mar 2018 12:32:59 -0400 Subject: [PATCH] cmd/compile: fix GOEXPERIMENT=preemptibleloops type-checking This experiment has gone stale. It causes a type-checking failure because the condition of the OIF produced by range loop lowering has type "untyped bool". Fix this by typechecking the whole OIF statement, not just its condition. This doesn't quite fix the whole experiment, but it gets further. Something about preemption point insertion is causing failures like "internal compiler error: likeliness prediction 1 for block b10 with 1 successors" in cmd/compile/internal/gc. Change-Id: I7d80d618d7c91c338bf5f2a8dc174d582a479df3 Reviewed-on: https://go-review.googlesource.com/102157 Run-TryBot: Austin Clements TryBot-Result: Gobot Gobot Reviewed-by: David Chase --- src/cmd/compile/internal/gc/range.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cmd/compile/internal/gc/range.go b/src/cmd/compile/internal/gc/range.go index 91f0cd363e..d8e504dd14 100644 --- a/src/cmd/compile/internal/gc/range.go +++ b/src/cmd/compile/internal/gc/range.go @@ -425,8 +425,7 @@ func walkrange(n *Node) *Node { if ifGuard != nil { ifGuard.Ninit.Append(init...) - typecheckslice(ifGuard.Left.Ninit.Slice(), Etop) - ifGuard.Left = typecheck(ifGuard.Left, Erv) + ifGuard = typecheck(ifGuard, Etop) } else { n.Ninit.Append(init...) } -- 2.48.1