New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chained goto &sub drops data too early. #7545
Comments
From henrik@gulbra.netThe introduction of patch 22373 in perl v5.8.4 was intended to clean up sub a { @_=("Hello!"); goto &b; } Before patch 22373, this prints "Hello!" as expected, but in v5.8.4 and One way to restore the original behavior is to temporarily increase the /Henrik |
From henrik@gulbra.netpp_ctl.c.patch--- pp_ctl.c.original Wed Jun 23 14:46:58 2004
+++ pp_ctl.c Tue Oct 19 11:54:12 2004
@@ -2120,6 +2120,7 @@
SV** mark;
I32 items = 0;
I32 oldsave;
+ I32 index;
retry:
if (!CvROOT(cv) && !CvXSUB(cv)) {
@@ -2166,6 +2167,11 @@
SvREFCNT_dec(GvAV(PL_defgv));
GvAV(PL_defgv) = cx->blk_sub.savearray;
#endif /* USE_5005THREADS */
+
+ /* Keep all @_ values alive till next sub. */
+ for(index=1; index<=items; index++)
+ SvREFCNT_inc(mark[index]);
+
/* abandon @_ if it got reified */
if (AvREAL(av)) {
oldav = av; /* delay until return */
@@ -2198,6 +2204,11 @@
/* Now do some callish stuff. */
SAVETMPS;
+
+ /* New scope: undo the temporary SvREFCNT_inc. */
+ for (index=1; index<=items; index++)
+ SAVEFREESV(mark[index]);
+
/* For reified @_, delay freeing till return from new sub */
if (oldav)
SAVEFREESV((SV*)oldav);
|
From henrik@gulbra.netFlags: Site configuration information for perl v5.8.5: Configured by root at Tue Aug 10 06:49:49 UTC 2004. Summary of my perl5 (revision 5 version 8 subversion 5) configuration: Locally applied patches: @INC for perl v5.8.5: Environment for perl v5.8.5: |
From @iabynOn Tue, Oct 19, 2004 at 10:36:48AM -0000, Henrik Gulbrandsen wrote:
Yes, this was my mistake, thanks for pointing it out!
Thanks for this. However, I went away for a bit and thought of something The problem revolves around what to do with a reified @_ - free it My new scheme is to simply transfer the reifiedness of the old @_ to the In the case where the new sub is an XS, the elements are mortalised Dave. -- Change 23418 by davem@davem-splatty on 2004/10/23 21:50:19 [perl #32039] Chained goto &sub drops data too early. Affected files ... ... //depot/perl/pp_ctl.c#407 edit Differences ... ==== //depot/perl/pp_ctl.c#407 (text) ==== @@ -2248,7 +2248,6 @@ label = 0; retry: /* Now do some callish stuff. */ ==== //depot/perl/t/op/goto.t#25 (xtext) ==== @@ -7,7 +7,7 @@ -print "1..46\n"; require "test.pl"; @@ -407,4 +407,12 @@ +# [perl #32039] Chained goto &sub drops data too early. |
The RT System itself - Status changed from 'new' to 'open' |
@iabyn - Status changed from 'open' to 'resolved' |
From @davidnicolI am a little surprised that we don't (can't?) re-use the existing @_ . On Sun, 24 Oct 2004 00:28:46 +0100, Dave Mitchell <davem@iabyn.com> wrote:
|
From @iabynOn Mon, Oct 25, 2004 at 10:56:32AM -0500, David Nicol wrote:
because then the following wouldn't work: sub f { $rf = \@_; g(2) } $ perl585 /tmp/p -- |
Migrated from rt.perl.org#32039 (status was 'resolved')
Searchable as RT32039$
The text was updated successfully, but these errors were encountered: