aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlberto Donizetti <alb.donizetti@gmail.com>2020-11-14 13:33:32 +0100
committerAlberto Donizetti <alb.donizetti@gmail.com>2020-11-16 08:22:10 +0000
commitf2eea4c1dc37886939c010daff89c03d5a3825be (patch)
tree9eeabd7f0de4846ab536f7a9be4feb87fbdcb444 /test
parent92c732e901a732855f4b813e6676264421eceae9 (diff)
downloadgo-f2eea4c1dc37886939c010daff89c03d5a3825be.tar.gz
go-f2eea4c1dc37886939c010daff89c03d5a3825be.zip
cmd/compile: mask SLL,SRL,SRAconst shift amount
mips SRA/SLL/SRL shift amounts are used mod 32; this change aligns the XXXconst rules to mask the shift amount by &31. Passes $ GOARCH=mips go build -toolexec 'toolstash -cmp' -a std $ GOARCH=mipsle go build -toolexec 'toolstash -cmp' -a std Fixes #42587 Change-Id: I6003ebd0bc500fba4cf6fb10254e1b557bf8c48f Reviewed-on: https://go-review.googlesource.com/c/go/+/270117 Trust: Alberto Donizetti <alb.donizetti@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue42587.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/fixedbugs/issue42587.go b/test/fixedbugs/issue42587.go
new file mode 100644
index 0000000000..d10ba979d5
--- /dev/null
+++ b/test/fixedbugs/issue42587.go
@@ -0,0 +1,15 @@
+// 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() {
+ var i, j int
+ _ = func() {
+ i = 32
+ j = j>>i | len([]int{})
+ }
+}