In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/5c24ac0b0c104d20c33f36ee47a3ab87844d7f7f?hp=2f222bbdd2d6da605708c3ab620ac25c62481179>

- Log -----------------------------------------------------------------
commit 5c24ac0b0c104d20c33f36ee47a3ab87844d7f7f
Author: Father Chrysostomos <[email protected]>
Date:   Sun Jul 28 14:12:28 2013 -0700

    perldelta for 2f222bbd/#119051 (\&$glob crashing)

M       pod/perldelta.pod

commit 07a05c08e908090dbce2612fa6da7496067a0d53
Author: Father Chrysostomos <[email protected]>
Date:   Sun Jul 28 14:10:10 2013 -0700

    [perl #119055] Make qq with no vars read-only
    
    In commit 2484f8db I stopped constant folding from changing the read-
    onliness of expressions like 1+2, which should return mutable values,
    seeing that ${\1}+2 returns a mutable value.  (After all, constant
    folding is supposed to be solely an optimisation, without changing
    behaviour.)
    
    This is accomplished by turning on the PADTMP flag, which tells opera-
    tors like \ to copy the scalar.
    
    I did not realise at the time that some qq strings like "hello\n" and
    qq "foo" (but not just "foo") are implemented using constant folding.
    The lexer outputs something like stringify("foo"), which is compiled
    down to a stringify op with a constant ("foo") as its only child.
    
    In this case we really do want qq"foo" to be treated as a single con-
    stant.  That it is implemented using folding while "foo" is not is an
    implementation detail we should hide.
    
    So turn off the PADTMP flag when folding a stringify op.

M       op.c
M       t/comp/fold.t

commit 7a5b1e22b731c65eb2ce1c4fc188bab00ac4ae8d
Author: Father Chrysostomos <[email protected]>
Date:   Sun Jul 28 13:21:24 2013 -0700

    Exempt clang from -Wunused-value when run as cc
    
    We already have an exception for it when called as clang or clang-1.2.3,
    but not when called as cc or anything else.  Mac OS X Mountain Lion
    therefore ends up spitting out lots of warnings, as cc is a symlink
    to clang.

M       cflags.SH

commit ba36554e02872e48d146177a57a9cfb154727fae
Author: Father Chrysostomos <[email protected]>
Date:   Sun Jul 28 13:19:33 2013 -0700

    [perl #119043] Exempt shared hash key consts from ro
    
    Commit 19130678b4 stopped copy-on-write scalars from being exempt from
    readonliness in ck_svconst (called for every OP_CONST).  That was for
    the sake of consistency.
    
    It turns out this breaks CPAN modules, so change it back, but only for
    shared hash key scalars, not other COW scalars.
    
    This is an historical artefact left over from when copy-on-write used
    the read-only flag without the scalar actually being read-only.

M       lib/overload.t
M       op.c

commit f99a5f08f203af84430e677e25df49557c55c24f
Author: Father Chrysostomos <[email protected]>
Date:   Sun Jul 28 13:01:59 2013 -0700

    [perl #119045] Make list constant mutable again
    
    This broke CPAN.  Maybe we need to rethink this....

M       dist/constant/lib/constant.pm
M       dist/constant/t/constant.t
-----------------------------------------------------------------------

Summary of changes:
 cflags.SH                     | 9 +++++++++
 dist/constant/lib/constant.pm | 3 ++-
 dist/constant/t/constant.t    | 1 +
 lib/overload.t                | 7 +++----
 op.c                          | 7 +++++--
 pod/perldelta.pod             | 4 +++-
 t/comp/fold.t                 | 9 ++++++++-
 7 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/cflags.SH b/cflags.SH
index b377ece..e1c409d 100755
--- a/cflags.SH
+++ b/cflags.SH
@@ -327,6 +327,15 @@ for file do
         esac
       done
       ;;
+    *)
+      # clang may not be called clang
+      case "`$cc -v 2>&1`" in
+      *clang*)
+        case "$warn" in
+        *-Wno-unused-value) ;;
+        *) warn="$warn -Wno-unused-value"
+        esac
+      esac
     esac
 
 
diff --git a/dist/constant/lib/constant.pm b/dist/constant/lib/constant.pm
index b8fa025..ee5e376 100644
--- a/dist/constant/lib/constant.pm
+++ b/dist/constant/lib/constant.pm
@@ -162,7 +162,8 @@ sub import {
                my @list = @_;
                if (_CAN_PCS_FOR_ARRAY) {
                    Internals::SvREADONLY(@list, 1);
-                   Internals::SvREADONLY($list[$_], 1) for 0..$#list;
+                   # Disabled for now; see perl #119045:
+                   #Internals::SvREADONLY($list[$_], 1) for 0..$#list;
                    if ($symtab && !exists $symtab->{$name}) {
                        $symtab->{$name} = \@list;
                        $flush_mro++;
diff --git a/dist/constant/t/constant.t b/dist/constant/t/constant.t
index 129196a..78f21ac 100644
--- a/dist/constant/t/constant.t
+++ b/dist/constant/t/constant.t
@@ -393,6 +393,7 @@ SKIP: {
 # 5.19.3 and later.
 SKIP: {
     skip "fails under 5.19.2 and earlier", 2 if $] < 5.019003;
+    local $TODO = "disabled for now; breaks CPAN; see perl #119045";
     use constant constant_list => 1..2;
     for (constant_list) {
        my $num = $_;
diff --git a/lib/overload.t b/lib/overload.t
index 3af969b..e9ceb50 100644
--- a/lib/overload.t
+++ b/lib/overload.t
@@ -1293,16 +1293,15 @@ foreach my $op (qw(<=> == != < <= > >=)) {
 }
 
 {
-    # Check readonliness of constants, whether shared hash key
-    # scalars or no (brought up in bug #109744)
+    # Check readonliness of constants (brought up in bug #109744)
+    # For historical reasons, shared hash key scalars are exempt
     BEGIN { overload::constant integer => sub { "main" }; }
     eval { ${\5} = 'whatever' };
     like $@, qr/^Modification of a read-only value attempted at /,
        'constant overloading makes read-only constants';
     BEGIN { overload::constant integer => sub { __PACKAGE__ }; }
     eval { ${\5} = 'whatever' };
-    like $@, qr/^Modification of a read-only value attempted at /,
-       '... even with shared hash key scalars';
+    is $@, "", 'except with shared hash key scalars';
 }
 
 {
diff --git a/op.c b/op.c
index 7576509..55bfbf0 100644
--- a/op.c
+++ b/op.c
@@ -3333,7 +3333,8 @@ S_fold_constants(pTHX_ OP *o)
     op_free(o);
 #endif
     assert(sv);
-    if (!SvIMMORTAL(sv)) SvPADTMP_on(sv);
+    if (type == OP_STRINGIFY) SvPADTMP_off(sv);
+    else if (!SvIMMORTAL(sv)) SvPADTMP_on(sv);
     if (type == OP_RV2GV)
        newop = newGVOP(OP_GV, 0, MUTABLE_GV(sv));
     else
@@ -10568,7 +10569,9 @@ Perl_ck_svconst(pTHX_ OP *o)
 {
     PERL_ARGS_ASSERT_CK_SVCONST;
     PERL_UNUSED_CONTEXT;
-    SvREADONLY_on(cSVOPo->op_sv);
+    /* For historical reasons, shared hash scalars are not made read-only.
+     */
+    if (!SvIsCOW_shared_hash(cSVOPo->op_sv)) SvREADONLY_on(cSVOPo->op_sv);
     return o;
 }
 
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 68c2ce3..5dc1187 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -376,7 +376,9 @@ files in F<ext/> and F<lib/> are best summarized in 
L</Modules and Pragmata>.
 
 =item *
 
-XXX
+Autovivifying a subroutine stub via C<\&$glob> started causing crashes in
+Perl 5.18.0 if the $glob was merely a copy of a real glob, i.e., a scalar
+that had had a glob assigned to it.  This has been fixed [perl #119051].
 
 =back
 
diff --git a/t/comp/fold.t b/t/comp/fold.t
index c483c99..64d4d23 100644
--- a/t/comp/fold.t
+++ b/t/comp/fold.t
@@ -4,7 +4,7 @@
 # we've not yet verified that use works.
 # use strict;
 
-print "1..27\n";
+print "1..28\n";
 my $test = 0;
 
 # Historically constant folding was performed by evaluating the ops, and if
@@ -158,3 +158,10 @@ for(1+2) {
           " - 1+2 returns mutable value, just like \$a+\$b",
           "\n";
 }
+
+# [perl #119055]
+# We hide the implementation detail that qq "foo" is implemented using
+# constant folding.
+eval { ${\"hello\n"}++ };
+print "not " unless $@ =~ "Modification of a read-only value attempted at";
+print "ok ", ++$test, " - qq with no vars is a constant\n";

--
Perl5 Master Repository

Reply via email to