mirror of
https://github.com/golang/go
synced 2024-11-23 08:50:03 -07:00
cmd/compile: make sure instrumented call has type width
The width of the type of an external variable defined with a type literal may not be set when the instrumentation pass is run. There are two cases in the standard library that fail without the call to dowidth: ../../../src/encoding/base32/base32.go:322: constant -1000000000 overflows uintptr ../../../src/encoding/base32/base32.go:329: constant -1000000000 overflows uintptr ../../../src/encoding/json/encode.go:385: constant -1000000000 overflows uintptr ../../../src/encoding/json/encode.go:387: constant -1000000000 overflows uintptr Change-Id: I7c3334f7decdb7488595ffe4090cd262d7334283 Reviewed-on: https://go-review.googlesource.com/16331 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
6326786ce7
commit
9179c9cb5c
@ -37,6 +37,11 @@ fi
|
|||||||
|
|
||||||
status=0
|
status=0
|
||||||
|
|
||||||
|
if ! go build -msan std; then
|
||||||
|
echo "FAIL: build -msan std"
|
||||||
|
status=1
|
||||||
|
fi
|
||||||
|
|
||||||
if ! go run -msan msan.go; then
|
if ! go run -msan msan.go; then
|
||||||
echo "FAIL: msan"
|
echo "FAIL: msan"
|
||||||
status=1
|
status=1
|
||||||
|
@ -502,13 +502,25 @@ func callinstr(np **Node, init **NodeList, wr int, skip int) bool {
|
|||||||
if wr != 0 {
|
if wr != 0 {
|
||||||
name = "msanwrite"
|
name = "msanwrite"
|
||||||
}
|
}
|
||||||
f = mkcall(name, nil, init, uintptraddr(n), Nodintconst(t.Width))
|
// dowidth may not have been called for PEXTERN.
|
||||||
|
dowidth(t)
|
||||||
|
w := t.Width
|
||||||
|
if w == BADWIDTH {
|
||||||
|
Fatalf("instrument: %v badwidth", t)
|
||||||
|
}
|
||||||
|
f = mkcall(name, nil, init, uintptraddr(n), Nodintconst(w))
|
||||||
} else if flag_race != 0 && (t.Etype == TSTRUCT || Isfixedarray(t)) {
|
} else if flag_race != 0 && (t.Etype == TSTRUCT || Isfixedarray(t)) {
|
||||||
name := "racereadrange"
|
name := "racereadrange"
|
||||||
if wr != 0 {
|
if wr != 0 {
|
||||||
name = "racewriterange"
|
name = "racewriterange"
|
||||||
}
|
}
|
||||||
f = mkcall(name, nil, init, uintptraddr(n), Nodintconst(t.Width))
|
// dowidth may not have been called for PEXTERN.
|
||||||
|
dowidth(t)
|
||||||
|
w := t.Width
|
||||||
|
if w == BADWIDTH {
|
||||||
|
Fatalf("instrument: %v badwidth", t)
|
||||||
|
}
|
||||||
|
f = mkcall(name, nil, init, uintptraddr(n), Nodintconst(w))
|
||||||
} else if flag_race != 0 {
|
} else if flag_race != 0 {
|
||||||
name := "raceread"
|
name := "raceread"
|
||||||
if wr != 0 {
|
if wr != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user