Change 17835 by [EMAIL PROTECTED] on 2002/09/04 13:23:17
fix coredump after 64k-deep recursion
Subject: Re: debugging coredump with -DD
From: [EMAIL PROTECTED]
Date: Tue, 03 Sep 2002 14:34:20 +0100
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
.... //depot/perl/cop.h#68 edit
.... //depot/perl/t/op/recurse.t#9 edit
Differences ...
==== //depot/perl/cop.h#68 (text) ====
Index: perl/cop.h
--- perl/cop.h#67~16724~ Tue May 21 10:51:00 2002
+++ perl/cop.h Wed Sep 4 06:23:17 2002
@@ -111,7 +111,7 @@
AV * savearray;
#endif /* USE_5005THREADS */
AV * argarray;
- U16 olddepth;
+ long olddepth;
U8 hasargs;
U8 lval; /* XXX merge lval and hasargs? */
SV ** oldcurpad;
@@ -119,7 +119,7 @@
#define PUSHSUB(cx) \
cx->blk_sub.cv = cv; \
- cx->blk_sub.olddepth = (U16)CvDEPTH(cv); \
+ cx->blk_sub.olddepth = CvDEPTH(cv); \
cx->blk_sub.hasargs = hasargs; \
cx->blk_sub.lval = PL_op->op_private & \
(OPpLVAL_INTRO|OPpENTERSUB_INARGS);
==== //depot/perl/t/op/recurse.t#9 (xtext) ====
Index: perl/t/op/recurse.t
--- perl/t/op/recurse.t#8~16680~ Sat May 18 11:43:35 2002
+++ perl/t/op/recurse.t Wed Sep 4 06:23:17 2002
@@ -8,7 +8,7 @@
chdir 't' if -d 't';
@INC = qw(. ../lib);
require "test.pl";
- plan(tests => 26);
+ plan(tests => 28);
}
use strict;
@@ -112,6 +112,9 @@
is(sillysum(1000), 1000*1001/2, "recursive sum of 1..1000");
}
-
-
-
+# check ok for recursion depth > 65536
+is(runperl(
+ nolib => 1,
+ prog => q{$d=0; $e=1; sub c { ++$d; if ($d > 66000) { $e=0 } else { c(); c()
+unless $d % 32768 } --$d } c(); exit $e},
+), '', "64K deep recursion - no output expected");
+is($?, 0, "64K deep recursion - no coredump expected");
End of Patch.