develooper Front page | perl.perl5.porters | Postings from June 2013

[perl #37420] taking reference to a constant sub param makes a copy in threaded perl

From:
Father Chrysostomos via RT
Date:
June 30, 2013 20:51
Subject:
[perl #37420] taking reference to a constant sub param makes a copy in threaded perl
Message ID:
rt-3.6.HEAD-2552-1372625463-373.37420-14-0@perl.org
On Tue Oct 11 17:09:58 2005, ysth wrote:
> This is a bug report for perl from sthoenna@efn.org,
> generated with the help of perlbug 1.35 running under perl v5.8.7.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
>   perl -we'use Devel::Peek; sub {Dump $_[0]}->("Foo")'
> 
> shows $_[0] having the PADTMP and PADBUSY flags under threaded perl
> but not threaded perl.  This triggers the PADTMP case in pp.c:S_refto
> which makes \$_[0] generate a ref to a copy to the constant instead
> of to the constant itself.
> 
> As a result, this:
> 
>   perl -wle'sub { print ${\$_[0]} .= "bar" }->("foo")'
> 
> erroneously prints foobar with a threaded perl but correctly gives
> "Modification of a read-only value attempted" with an unthreaded perl.

This is a duplicate of #21979.

-- 

Father Chrysostomos




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About