aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2020-08-13 12:39:04 -0700
committerDmitri Shuralyov <dmitshur@golang.org>2020-08-21 20:58:15 +0000
commit9c17883f28ceb2aba94ae7f51269f1c982fd7f8b (patch)
tree6b40d080f7f89431579c872b6a60359899f511ce /test
parent46a34f93a20bd7e249bebde5c937765dd779bf4f (diff)
downloadgo-9c17883f28ceb2aba94ae7f51269f1c982fd7f8b.tar.gz
go-9c17883f28ceb2aba94ae7f51269f1c982fd7f8b.zip
cmd/compile: correct type of CvtBoolToUint8 values
Fixes #40772 Change-Id: I539f07d1f958dacee87d846171a8889d03182d25 Reviewed-on: https://go-review.googlesource.com/c/go/+/248397 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-on: https://go-review.googlesource.com/c/go/+/248401
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue40746.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/fixedbugs/issue40746.go b/test/fixedbugs/issue40746.go
new file mode 100644
index 0000000000..235282fd90
--- /dev/null
+++ b/test/fixedbugs/issue40746.go
@@ -0,0 +1,19 @@
+// compile
+
+// Copyright 2020 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(x byte, b bool) byte {
+ var c byte
+ if b {
+ c = 1
+ }
+
+ if int8(c) < 0 {
+ x++
+ }
+ return x
+}