From dd931d9b48647e898dc80927c532ae93cc09e192 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 24 Sep 2018 21:46:21 +0000 Subject: libgo: update to Go 1.11 Reviewed-on: https://go-review.googlesource.com/136435 gotools/: * Makefile.am (mostlyclean-local): Run chmod on check-go-dir to make sure it is writable. (check-go-tools): Likewise. (check-vet): Copy internal/objabi to check-vet-dir. * Makefile.in: Rebuild. From-SVN: r264546 --- libgo/runtime/go-runtime-error.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libgo/runtime/go-runtime-error.c') diff --git a/libgo/runtime/go-runtime-error.c b/libgo/runtime/go-runtime-error.c index 5edbeeb..f1c1650 100644 --- a/libgo/runtime/go-runtime-error.c +++ b/libgo/runtime/go-runtime-error.c @@ -60,16 +60,29 @@ extern void __go_runtime_error (int32) __attribute__ ((noreturn)); void __go_runtime_error (int32 i) { + struct funcfileline_return fileline; + bool in_runtime; + + fileline = runtime_funcfileline ((uintptr) runtime_getcallerpc(), 0); + in_runtime = (fileline.retfn.len > 0 + && (__builtin_strncmp ((const char *) fileline.retfn.str, + "runtime.", 8) + == 0)); + switch (i) { case SLICE_INDEX_OUT_OF_BOUNDS: case ARRAY_INDEX_OUT_OF_BOUNDS: case STRING_INDEX_OUT_OF_BOUNDS: + if (in_runtime) + runtime_throw ("index out of range"); runtime_panicstring ("index out of range"); case SLICE_SLICE_OUT_OF_BOUNDS: case ARRAY_SLICE_OUT_OF_BOUNDS: case STRING_SLICE_OUT_OF_BOUNDS: + if (in_runtime) + runtime_throw ("slice bounds out of range"); runtime_panicstring ("slice bounds out of range"); case NIL_DEREFERENCE: -- cgit v1.1