aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/checkptr_test.go
diff options
context:
space:
mode:
authorJohan Jansson <johan.jansson@iki.fi>2020-03-11 21:05:21 +0200
committerIan Lance Taylor <iant@golang.org>2020-03-12 23:45:51 +0000
commit1f231d74f6e6b7ce1ccdbf49fc12b022dd875196 (patch)
tree67c61ac008a57ced0f2b68c33263a60b9348d14b /src/runtime/checkptr_test.go
parent5d70cb066756369f99be6ffa69b639626d95e647 (diff)
downloadgo-1f231d74f6e6b7ce1ccdbf49fc12b022dd875196.tar.gz
go-1f231d74f6e6b7ce1ccdbf49fc12b022dd875196.zip
runtime: emit more specific errors from checkptr
Update error messages for pointer alignment checks and pointer arithmetic checks so that each type of error has a unique error message. Fixes #37488 Change-Id: Ida2c2fa3f041a3307d665879a463f9e8f2c1fd03 Reviewed-on: https://go-review.googlesource.com/c/go/+/223037 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/checkptr_test.go')
-rw-r--r--src/runtime/checkptr_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/runtime/checkptr_test.go b/src/runtime/checkptr_test.go
index c5f22cc101..1a7c253733 100644
--- a/src/runtime/checkptr_test.go
+++ b/src/runtime/checkptr_test.go
@@ -24,10 +24,10 @@ func TestCheckPtr(t *testing.T) {
cmd string
want string
}{
- {"CheckPtrAlignment", "fatal error: checkptr: unsafe pointer conversion\n"},
- {"CheckPtrArithmetic", "fatal error: checkptr: unsafe pointer arithmetic\n"},
- {"CheckPtrSize", "fatal error: checkptr: unsafe pointer conversion\n"},
- {"CheckPtrSmall", "fatal error: checkptr: unsafe pointer arithmetic\n"},
+ {"CheckPtrAlignment", "fatal error: checkptr: misaligned pointer conversion\n"},
+ {"CheckPtrArithmetic", "fatal error: checkptr: pointer arithmetic result points to invalid allocation\n"},
+ {"CheckPtrSize", "fatal error: checkptr: converted pointer straddles multiple allocations\n"},
+ {"CheckPtrSmall", "fatal error: checkptr: pointer arithmetic computed bad pointer value\n"},
}
for _, tc := range testCases {