diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-06-22 04:13:36 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-06-22 04:13:36 +0000 |
commit | 55ea0ea07dc837e596f81ce972361ec46d2cb1fe (patch) | |
tree | b318ec0d3a71e91a29241ff9dbe39c796b084a0a /libgo/runtime/go-runtime-error.c | |
parent | bc216de9f65527cd80fd02a645da036e8bfb7818 (diff) | |
download | gcc-55ea0ea07dc837e596f81ce972361ec46d2cb1fe.zip gcc-55ea0ea07dc837e596f81ce972361ec46d2cb1fe.tar.gz gcc-55ea0ea07dc837e596f81ce972361ec46d2cb1fe.tar.bz2 |
compiler, runtime: better stack trace for `go f()` where f is nil
The test for this is TestGoNil in the runtime package, which we don't
run yet but will run with a subsequent gotools patch.
Updates golang/go#8045
Reviewed-on: https://go-review.googlesource.com/46392
From-SVN: r249494
Diffstat (limited to 'libgo/runtime/go-runtime-error.c')
-rw-r--r-- | libgo/runtime/go-runtime-error.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libgo/runtime/go-runtime-error.c b/libgo/runtime/go-runtime-error.c index f5ab4f9..4f563fc 100644 --- a/libgo/runtime/go-runtime-error.c +++ b/libgo/runtime/go-runtime-error.c @@ -49,7 +49,10 @@ enum MAKE_CHAN_OUT_OF_BOUNDS = 9, /* Integer division by zero. */ - DIVISION_BY_ZERO = 10 + DIVISION_BY_ZERO = 10, + + /* Go statement with nil function. */ + GO_NIL = 11 }; extern void __go_runtime_error () __attribute__ ((noreturn)); @@ -84,6 +87,12 @@ __go_runtime_error (int32 i) case DIVISION_BY_ZERO: runtime_panicstring ("integer divide by zero"); + case GO_NIL: + /* This one is a throw, rather than a panic. Set throwing to + not dump full stacks. */ + runtime_g()->m->throwing = -1; + runtime_throw ("go of nil func value"); + default: runtime_panicstring ("unknown runtime error"); } |