From 5d000a8b6268c09697c64c76bade1daa86f43a9e Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Sat, 26 Oct 2019 09:24:29 +0200 Subject: [PATCH] test: add test for fixed internal compiler error Updates #35157 (the bug there was fixed by CL200861) Change-Id: I67069207b4cdc2ad4a475dd0bbc8555ecc5f534f Reviewed-on: https://go-review.googlesource.com/c/go/+/203598 Run-TryBot: Giovanni Bajo TryBot-Result: Gobot Gobot Reviewed-by: Alberto Donizetti --- test/fixedbugs/issue35157.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/fixedbugs/issue35157.go diff --git a/test/fixedbugs/issue35157.go b/test/fixedbugs/issue35157.go new file mode 100644 index 0000000000..c9c4899e0c --- /dev/null +++ b/test/fixedbugs/issue35157.go @@ -0,0 +1,20 @@ +// compile + +// Copyright 2019 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. + +package p + +func f() { + var i int + var b *bool + var s0, s1, s2 string + + if *b { + s2 = s2[:1] + i = 1 + } + s1 = s1[i:-i+i] + s1[-i+i:i+2] + s1 = s0[i:-i] +}