runtime: don't assume that _ = *s will panic if s is nil
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 22 Jun 2017 14:46:12 +0000 (14:46 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 22 Jun 2017 14:46:12 +0000 (14:46 +0000)
commitc016fd32fe7da1a8c97f96f7e9767e4e300b3d28
tree60dae3998cda620358797eb5bf0fff80691fc09e
parent3b0ddadf74ec9c7aa404765ec50bb55d255dbec7
runtime: don't assume that _ = *s will panic if s is nil

    With the gc toolchain apparently
            var s *string
            _ = *s
    is enough to panic with a nil pointer dereference. The gccgo compiler
    will simply discard the dereference, which I think is a reasonable and
    acceptable optimization. Change the tests to use an exported variable
    instead. The tests are not currently run, but they will be with a
    later patch to gotools.

    Reviewed-on: https://go-review.googlesource.com/46450

From-SVN: r249562
gcc/go/gofrontend/MERGE
libgo/go/runtime/testdata/testprog/crash.go
libgo/go/runtime/testdata/testprogcgo/crash.go