diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-06-22 04:13:36 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-06-22 04:13:36 +0000 |
commit | 789c8746707c870f6d3aa4e33f81e362914a398c (patch) | |
tree | b318ec0d3a71e91a29241ff9dbe39c796b084a0a /libgo | |
parent | 0a54e2a6031f4ada89dfc7c9696afcabace2d2f4 (diff) | |
download | gcc-789c8746707c870f6d3aa4e33f81e362914a398c.tar.gz |
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
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249494 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-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 f5ab4f9196b..4f563fc9ed5 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"); } |