Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
golang
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Debian Go Packaging Team
compiler
golang
Commits
a0cd15c6
Commit
a0cd15c6
authored
7 years ago
by
Michael Stapelberg
Browse files
Options
Downloads
Patches
Plain Diff
Add debian/patches/0003-Do-not-use-SP-as-index-reg.patch (Closes: #877541)
parent
e78fc7ac
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/patches/0003-Do-not-use-SP-as-index-reg.patch
+56
-0
56 additions, 0 deletions
debian/patches/0003-Do-not-use-SP-as-index-reg.patch
debian/patches/series
+1
-0
1 addition, 0 deletions
debian/patches/series
with
57 additions
and
0 deletions
debian/patches/0003-Do-not-use-SP-as-index-reg.patch
0 → 100644
+
56
−
0
View file @
a0cd15c6
Author: Keith Randall <khr@golang.org>
Date: Wed Oct 25 13:46:38 2017 -0700
Description: cmd/compile: make sure not to use SP as an index register
...because that's an illegal addressing mode.
Reviewed-on: https://go-review.googlesource.com/73551
Bug-Upstream: https://github.com/golang/go/issues/22429
diff --git a/src/cmd/compile/internal/x86/387.go b/src/cmd/compile/internal/x86/387.go
index cdac000..7a36224 100644
--- a/src/cmd/compile/internal/x86/387.go
+++ b/src/cmd/compile/internal/x86/387.go
@@ -46,6 +46,9 @@
case ssa.Op386MOVSSloadidx1, ssa.Op386MOVSDloadidx1:
p.From.Scale = 1
p.From.Index = v.Args[1].Reg()
+ if p.From.Index == x86.REG_SP {
+ p.From.Reg, p.From.Index = p.From.Index, p.From.Reg
+ }
case ssa.Op386MOVSSloadidx4:
p.From.Scale = 4
p.From.Index = v.Args[1].Reg()
@@ -95,6 +98,9 @@
case ssa.Op386MOVSSstoreidx1, ssa.Op386MOVSDstoreidx1:
p.To.Scale = 1
p.To.Index = v.Args[1].Reg()
+ if p.To.Index == x86.REG_SP {
+ p.To.Reg, p.To.Index = p.To.Index, p.To.Reg
+ }
case ssa.Op386MOVSSstoreidx4:
p.To.Scale = 4
p.To.Index = v.Args[1].Reg()
diff --git a/test/fixedbugs/issue22429.go b/test/fixedbugs/issue22429.go
new file mode 100644
index 0000000..289b434
--- /dev/null
+++ b/test/fixedbugs/issue22429.go
@@ -0,0 +1,18 @@
+// compile
+
+// Copyright 2017 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.
+
+// Make sure SSA->assembly pass can handle SP as an index register.
+
+package p
+
+type T struct {
+ a,b,c,d float32
+}
+
+func f(a *[8]T, i,j,k int) float32 {
+ b := *a
+ return b[i].a + b[j].b + b[k].c
+}
This diff is collapsed.
Click to expand it.
debian/patches/series
+
1
−
0
View file @
a0cd15c6
0002-reproducible-BUILD_PATH_PREFIX_MAP.patch
0003-Do-not-use-SP-as-index-reg.patch
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment