aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime1.go
diff options
context:
space:
mode:
authorShenghou Ma <minux@golang.org>2015-09-03 02:44:26 -0400
committerMinux Ma <minux@golang.org>2015-11-25 00:46:57 +0000
commit3583a44ed2ae27495626caaa431b197187dcf01b (patch)
tree571f3308f21b6be4d1107e9974af1f76caa273bc /src/runtime/runtime1.go
parent3cac3b5fca48dbd5715bb05936252eba1bb51c26 (diff)
downloadgo-3583a44ed2ae27495626caaa431b197187dcf01b.tar.gz
go-3583a44ed2ae27495626caaa431b197187dcf01b.zip
runtime: check that masks and shifts are correct aligned
We need a runtime check because the original issue is encountered when running cross compiled windows program from linux. It's better to give a meaningful crash message earlier than to segfault later. The added test should not impose any measurable overhead to Go programs. For #12415. Change-Id: Ib4a24ef560c09c0585b351d62eefd157b6b7f04c Reviewed-on: https://go-review.googlesource.com/14207 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/runtime1.go')
-rw-r--r--src/runtime/runtime1.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go
index 71afd79b55..3c4f47dd2e 100644
--- a/src/runtime/runtime1.go
+++ b/src/runtime/runtime1.go
@@ -296,6 +296,10 @@ func check() {
if _FixedStack != round2(_FixedStack) {
throw("FixedStack is not power-of-2")
}
+
+ if !checkASM() {
+ throw("assembly checks failed")
+ }
}
type dbgVar struct {