]> git.ipfire.org Git - thirdparty/gcc.git/commit
runtime: use the call instruction's PC for panic-in-runtime detection
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 29 Jan 2019 00:49:23 +0000 (00:49 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 29 Jan 2019 00:49:23 +0000 (00:49 +0000)
commit24d49c9285af11b774fb4df64dc76e45d1a53cd8
tree30cc483c1055da9667de55c49b7ef3673f6266b4
parent5f15e7183a88f2ab1cd6765f0d14a382031e99a1
runtime: use the call instruction's PC for panic-in-runtime detection

    If a panic happens in the runtime we turn that into a fatal error.
    We use the caller's PC to determine if the panic call is inside
    the runtime. getcallerpc returns the PC immediately after the
    call instruction. If the call is the very last instruction of a
    function, it may not find this PC belong to a runtime function,
    giving false result. We need to back off the PC by 1 to the call
    instruction.

    The gc runtime doesn't do this because the gc compiler always
    emit an instruction following a panic call, presumably an UNDEF
    instruction which turns into an architecture-specific illegal
    instruction. Our compiler doesn't do this.

    Reviewed-on: https://go-review.googlesource.com/c/159437

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268358 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/gofrontend/MERGE
libgo/go/runtime/panic.go
libgo/runtime/go-runtime-error.c