compiler: nil-checked pointers and index expressions can trap

The compiler was treating indirections through pointers that had been
explicitly checked against nil and slice and string index expressions
as non-trapping memory references.  That is true for ordinary Go
programs, but it isn't true if the programs construct their own memory
addresses.  In particular it isn't true for the kinds of programs that
want to use runtime.SetPanicOnFault.

The effect of this will be slightly larger binaries, due to additional
exception information, and perhaps slightly less optimization.

Change-Id: I5a9f82001a8c1b7c03a5853eef9585ada5ee2202
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279960
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
1 file changed