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
Modifying an alias to a read-only item of an argument list of a subroutine works, while it's expected to fail #6453
Comments
From trivizki@bigfoot.comThis is a bug report for perl from trivizki@bigfoot.com, sub subname{ Runs with no errors and even modifies $_, although it should not run, as it tries to modify sub subname{ "Modification of a read-only value attempted" as the codes should act the same - $_ is just an Perl 5.6.1 behaved as I expected, while 5.8 did run the code on my system as well as Thanks, Flags: Site configuration information for perl v5.8.0: Configured by ActiveState at Tue Feb 4 18:07:44 2003. Summary of my perl5 (revision 5 version 8 subversion 0) configuration: Locally applied patches: @INC for perl v5.8.0: Environment for perl v5.8.0: |
From enache@rdslink.roOn Wed, Apr 16, 2003 at 10:05:55PM -0000, trivizki@bigfoot.com (via RT) wrote:
$ perl -e 'sub a { ${\$_[0]} = 5 } a "a"' With ithreads constants are now copied on the pad - see op.c:6088, so So the code in S_refto with take this path when creating a reference else if (SvPADTMP(sv) && !IS_PADGV(sv)) and the SVf_READONLY flag will be lost. Regards |
From sky@nanisky.comOn torsdag, apr 17, 2003, at 16:39 Europe/Stockholm, Enache Adrian
Try running it in non threaded perl and see what it does, it should Arthur |
From enache@rdslink.roOn Thu, Apr 17, 2003 at 08:24:51PM +0200, Arthur Bergman wrote:
Are you sure ? $ ./perl -e 'sub a { ${\$_[0]} = 5 } a "a"' Regards |
From sky@nanisky.comOn fredag, apr 18, 2003, at 03:21 Europe/Stockholm, Enache Adrian wrote:
Yes I am sure, if it does one thing in non threaded perl, threaded perl So this is a bug in the threads code. Arthur |
From @ysthCreated by @ysthperl -we'use Devel::Peek; sub {Dump $_[0]}->("Foo")' shows $_[0] having the PADTMP and PADBUSY flags under threaded perl As a result, this: perl -wle'sub { print ${\$_[0]} .= "bar" }->("foo")' erroneously prints foobar with a threaded perl but correctly gives Perl Info
|
From @dkI'd like to reopen this old bug as I've hit it in my own code... I've no Inline Patch--- pp.c.0 2012-01-06 01:07:34.511988700 +0100
+++ pp.c 2012-01-06 19:04:06.311428300 +0100
@@ -515,9 +515,11 @@
SvTEMP_off(sv);
SvREFCNT_inc_void_NN(sv);
}
- else if (SvPADTMP(sv) && !IS_PADGV(sv))
+ else if (SvPADTMP(sv) && !IS_PADGV(sv)) {
+ Perl_ck_warner(aTHX_ packWARN(WARN_MISC),
+ "Implicit copy of a read-only scalar due to aliasing");
sv = newSVsv(sv);
- else {
+ } else {
SvTEMP_off(sv);
SvREFCNT_inc_void_NN(sv);
} |
From @cpansproutOn Tue Oct 11 17:09:58 2005, ysth wrote:
This is a duplicate of #21979. -- Father Chrysostomos |
From [Unknown Contact. See original ticket]On Tue Oct 11 17:09:58 2005, ysth wrote:
This is a duplicate of #21979. -- Father Chrysostomos |
@cpansprout - Status changed from 'new' to 'open' |
From @cpansproutFixed in 82b84d0. -- Father Chrysostomos |
From [Unknown Contact. See original ticket]Fixed in 82b84d0. -- Father Chrysostomos |
@cpansprout - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#21979 (status was 'resolved')
Searchable as RT21979$
The text was updated successfully, but these errors were encountered: