diff options
| author | Keith Randall <khr@google.com> | 2018-07-12 11:44:05 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2018-07-12 19:06:09 +0000 |
| commit | 85cfa4d55e177a70913ce8977ce847af7c4298e2 (patch) | |
| tree | 5e1690662da0daf1a6dda3e4b7b9e43eddb92b3b /src | |
| parent | 0029cd479e344e0fa6930331cf86e6f985508163 (diff) | |
| download | go-85cfa4d55e177a70913ce8977ce847af7c4298e2.tar.xz | |
cmd/compile: handle degenerate write barrier case
If both branches of a write barrier test go to the same block,
then there's no unsafe points.
This can only happen if the resulting memory state is somehow dead,
which can only occur in degenerate cases, like infinite loops. No
point in cleaning up the useless branch in these situations.
Fixes #26024.
Change-Id: I93a7df9fdf2fc94c6c4b1fe61180dc4fd4a0871f
Reviewed-on: https://go-review.googlesource.com/123655
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/compile/internal/gc/plive.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/gc/plive.go b/src/cmd/compile/internal/gc/plive.go index 88b4380637..f78d051b06 100644 --- a/src/cmd/compile/internal/gc/plive.go +++ b/src/cmd/compile/internal/gc/plive.go @@ -692,6 +692,11 @@ func (lv *Liveness) markUnsafePoints() { lv.f.Fatalf("expected branch at write barrier block %v", wbBlock) } s0, s1 := wbBlock.Succs[0].Block(), wbBlock.Succs[1].Block() + if s0 == s1 { + // There's no difference between write barrier on and off. + // Thus there's no unsafe locations. See issue 26024. + continue + } if s0.Kind != ssa.BlockPlain || s1.Kind != ssa.BlockPlain { lv.f.Fatalf("expected successors of write barrier block %v to be plain", wbBlock) } |
