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
Trust: Ian Lance Taylor <>
Reviewed-by: Cherry Zhang <>
Reviewed-by: Than McIntosh <>
1 file changed