allow exit during fold_constants
Dave Mitchell [Tue, 9 May 2006 11:43:55 +0000 (11:43 +0000)]
eg BEGIN { $SIG{__WARN__} = sub{exit};} "a" == "b"

p4raw-id: //depot/perl@28135

op.c

diff --git a/op.c b/op.c
index 970f27a..c27d785 100644 (file)
--- a/op.c
+++ b/op.c
@@ -2227,6 +2227,11 @@ Perl_fold_constants(pTHX_ register OP *o)
            SvTEMP_off(sv);
        }
        break;
+    case 2:
+       /* my_exit() was called; propagate it */
+       JMPENV_POP;
+       JMPENV_JUMP(2);
+       /* NOTREACHED */
     case 3:
        /* Something tried to die.  Abandon constant folding.  */
        /* Pretend the error never happened.  */
@@ -2235,7 +2240,7 @@ Perl_fold_constants(pTHX_ register OP *o)
        break;
     default:
        JMPENV_POP;
-       /* Don't expect 1 (setjmp failed) or 2 (something called my_exit)  */
+       /* Don't expect 1 (setjmp failed) */
        Perl_croak(aTHX_ "panic: fold_constants JMPENV_PUSH returned %d", ret);
     }