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

Re: [perl #120041] regcomp.c missing parens and broken STCLASS

Thread Previous | Thread Next
October 1, 2013 09:04
Re: [perl #120041] regcomp.c missing parens and broken STCLASS
Message ID:
"Karl Williamson via RT" <> wrote:
:Commit  43a64b8b430604bd4d76fd256a5babdccaf0ab2b removed three lines
:which I thought were unnecessary.  It turns out that only two were
:unnecessary.  Commit a0dd42312a1f26356d2fdf49656e45b77c2cefb5 masked the
:problem by omitting necessary grouping parentheses which caused things
:to not execute the intended way, and there were no tests for this in our
:Now fixed by commit 77ebeeba5f5d47be96b3cef485cb98b1c4980510

I'm still confused about the intent of this twice-repeated mantra:
    if (! (ANYOF_FLAGS(data.start_class) & ANYOF_EMPTY_STRING)
        && ! ssc_is_anything(data.start_class))

Given that when the first clause is true, ssc_is_anything() immediately
returns FALSE, isn't this in both cases the same as:
    if (! (ANYOF_FLAGS(data.start_class) & ANYOF_EMPTY_STRING))

I think there'd be value in adding some brief comments about the intent
around these checks.

I note also that the new test ends up applying a rather pessimal
% ./perl -Ilib -Mre=debug -we '"" =~ /^A*\z/ or die;'
Compiling REx "^A*\z"
Final program:
   1: BOL (2)
   2: STAR (5)
   3:   EXACT <A> (0)
   5: EOS (6)
   6: END (0)
floating ""$ at 0..2147483647 (checking floating) anchored(BOL) minlen 0 
Matching REx "^A*\z" against ""
Found floating substr ""$ at offset 0...
Guessed: match at offset 0


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About