aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-18 08:34:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-18 08:34:40 +0000
commit730d4f18143d644684cab86e1bd3be1b288a4f55 (patch)
treebc0c491c4fd364c27bdacb44f2ba3bf09a05b029 /eval.c
parent4d02a2bf81e349c6d957f9be7ad9140adc922751 (diff)
downloadruby-730d4f18143d644684cab86e1bd3be1b288a4f55.tar.gz
eval.c: fix exit inside TAG
* eval.c (setup_exception): do not exit by goto inside PUSH_TAG/POP_TAG. it causes an infinite loop. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/eval.c b/eval.c
index 15a38c5d71..8c22b621bd 100644
--- a/eval.c
+++ b/eval.c
@@ -492,14 +492,11 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
file = rb_source_loc(&line);
if ((file && !NIL_P(mesg)) || (cause != Qundef)) {
- VALUE at;
int status;
TH_PUSH_TAG(th);
- if ((status = EXEC_TAG()) == 0) {
- VALUE bt;
- if (rb_threadptr_set_raised(th)) goto fatal;
- bt = rb_get_backtrace(mesg);
+ if (EXEC_TAG() == 0 && !(status = rb_threadptr_set_raised(th))) {
+ VALUE bt = rb_get_backtrace(mesg);
if (!NIL_P(bt) || cause == Qundef) {
if (OBJ_FROZEN(mesg)) {
mesg = rb_obj_dup(mesg);
@@ -509,13 +506,14 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
exc_setup_cause(mesg, cause);
}
if (NIL_P(bt)) {
- at = rb_threadptr_backtrace_object(th);
+ VALUE at = rb_threadptr_backtrace_object(th);
rb_ivar_set(mesg, idBt_locations, at);
set_backtrace(mesg, at);
}
rb_threadptr_reset_raised(th);
}
TH_POP_TAG();
+ if (status) goto fatal;
}
if (!NIL_P(mesg)) {