diff options
author | Ian Lance Taylor <iant@golang.org> | 2018-09-24 21:46:21 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-09-24 21:46:21 +0000 |
commit | dd931d9b48647e898dc80927c532ae93cc09e192 (patch) | |
tree | 71be2295cd79b8a182f6130611658db8628772d5 /libgo/runtime/go-runtime-error.c | |
parent | 779d8a5ad09b01428726ea5a0e6c87bd9ac3c0e4 (diff) | |
download | gcc-dd931d9b48647e898dc80927c532ae93cc09e192.zip gcc-dd931d9b48647e898dc80927c532ae93cc09e192.tar.gz gcc-dd931d9b48647e898dc80927c532ae93cc09e192.tar.bz2 |
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
Diffstat (limited to 'libgo/runtime/go-runtime-error.c')
-rw-r--r-- | libgo/runtime/go-runtime-error.c | 13 |
1 files changed, 13 insertions, 0 deletions
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: |