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

[perl #118213] /$qr/p broken under 5.18.0

Thread Next
From:
Father Chrysostomos via RT
Date:
July 7, 2013 05:49
Subject:
[perl #118213] /$qr/p broken under 5.18.0
Message ID:
rt-3.6.HEAD-2552-1373176136-600.118213-15-0@perl.org
On Tue May 28 03:45:45 2013, davem wrote:
> 
> This is a bug report for perl from davem@iabyn.com,
> generated with the help of perlbug 1.39 running under perl 5.18.0.
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> This code prints 'a' in 5.16.x, undef in 5.18.0:
> 
>     my $pat = qr/a/;
>     'aaaa'  =~ /$pat/gp or die;
>     print "MATCH=[${^MATCH}]\n";

This variation:

my $pat = qr/a/;
'aaaa' =~ /$pat/gp or die;
print "MATCH=[${^MATCH}-$&]\n";

prints this under blead:

MATCH=[-a]

It’s this bit in regcomp.c:Perl_reg_numbered_buff_fetch:

    if ( (    n == RX_BUFF_IDX_CARET_PREMATCH
           || n == RX_BUFF_IDX_CARET_FULLMATCH
           || n == RX_BUFF_IDX_CARET_POSTMATCH
         )
         && !(rx->extflags & RXf_PMf_KEEPCOPY)
    )
        goto ret_undef;

Instead of checking the KEEPCOPY flag, is it possible to check whether
the offsets are recorded?

I know this flag makes no difference under COW and we can probably
eliminate that whole if().  But do we need to fix this bug under
PERL_NO_COW as well?

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=118213

Thread Next


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