From: Gurusamy Sarathy Date: Thu, 8 Jun 2000 13:57:54 +0000 (+0000) Subject: @_ can't have junk in it even in the non-USE_ITHREADS case because X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ecf8e9dde37ff8f382bf4756913bb8ab7f0dba8c;p=p5sagit%2Fp5-mst-13.2.git @_ can't have junk in it even in the non-USE_ITHREADS case because caller() wants to populate @DB::args with it (causes a coredump in Carp::confess()) p4raw-id: //depot/perl@6214 --- diff --git a/cop.h b/cop.h index d6fdd23..adf3863 100644 --- a/cop.h +++ b/cop.h @@ -106,13 +106,9 @@ struct block_sub { } STMT_END #endif /* USE_THREADS */ -#ifdef USE_ITHREADS - /* junk in @_ spells trouble when cloning CVs, so don't leave any */ -# define CLEAR_ARGARRAY() av_clear(cx->blk_sub.argarray) -#else -# define CLEAR_ARGARRAY() NOOP -#endif /* USE_ITHREADS */ - +/* junk in @_ spells trouble when cloning CVs and in pp_caller(), so don't + * leave any */ +#define CLEAR_ARGARRAY() av_clear(cx->blk_sub.argarray) #define POPSUB(cx,sv) \ STMT_START { \ diff --git a/t/op/runlevel.t b/t/op/runlevel.t index e988ad9..3865e52 100755 --- a/t/op/runlevel.t +++ b/t/op/runlevel.t @@ -349,3 +349,18 @@ A 1 bar B 2 bar +######## +sub n { 0 } +sub f { my $x = shift; d(); } +f(n()); +f(); + +sub d { + my $i = 0; my @a; + while (do { { package DB; @a = caller($i++) } } ) { + @a = @DB::args; + for (@a) { print "$_\n"; $_ = '' } + } +} +EXPECT +0