diff options
author | Cherry Zhang <cherryyz@google.com> | 2019-05-10 15:08:17 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2019-05-11 03:02:33 +0000 |
commit | ce5ae2f4bc606ef1d8fddadf771e9889f481a4a4 (patch) | |
tree | e1fb47c77d3cd32cc9ff160f3a201c4538fa7eea /test/nilptr2.go | |
parent | f61cf6f3138d47e1e72dbd56c12e7d1f3314a813 (diff) | |
download | go-ce5ae2f4bc606ef1d8fddadf771e9889f481a4a4.tar.gz go-ce5ae2f4bc606ef1d8fddadf771e9889f481a4a4.zip |
test: use a real use function in nilptr2.go
Adjust the dummy use function to a real use. As suggested by the
println calls in the test, nilptr2.go supposes to check that a
used nil pointer dereference panics. This use function is not
real enough so an optimized compiler such as gccgo could
eliminate the call.
The spec requires that even a dummy use would cause a panic.
Unfortunately, due to #31151 this is not true for gccgo at -O1 or
above.
Change-Id: Ie07c8a5969ab94dad82d4f7cfec30597c25b7c46
Reviewed-on: https://go-review.googlesource.com/c/go/+/176579
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'test/nilptr2.go')
-rw-r--r-- | test/nilptr2.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/nilptr2.go b/test/nilptr2.go index a5c036999a..8a85b6dbcb 100644 --- a/test/nilptr2.go +++ b/test/nilptr2.go @@ -35,7 +35,10 @@ var m *M var m1 *M1 var m2 *M2 -func use(interface{}) { +var V interface{} + +func use(x interface{}) { + V = x } var tests = []struct{ |