This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: cl_and() fix
authorKarl Williamson <public@khwilliamson.com>
Tue, 1 Feb 2011 04:05:26 +0000 (21:05 -0700)
committerKarl Williamson <public@khwilliamson.com>
Wed, 2 Feb 2011 23:30:54 +0000 (16:30 -0700)
If ANDing two nodes together and they both have UNICODE_ALL set, the result
should also.  I don't have a test case for this, but the bug is exposed by some
commits soon to come in a test case in pat_advanced.t for cl_and.

regcomp.c

index 015b4ff..5bece17 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -795,9 +795,13 @@ S_cl_and(struct regnode_charclass_class *cl,
     if (!(and_with->flags & ANYOF_NON_UTF8_LATIN1_ALL))
        cl->flags &= ~ANYOF_NON_UTF8_LATIN1_ALL;
 
-    if (cl->flags & ANYOF_UNICODE_ALL && and_with->flags & ANYOF_NONBITMAP &&
-       !(and_with->flags & ANYOF_INVERT)) {
-       cl->flags &= ~ANYOF_UNICODE_ALL;
+    if (cl->flags & ANYOF_UNICODE_ALL
+       && and_with->flags & ANYOF_NONBITMAP
+       && !(and_with->flags & ANYOF_INVERT))
+    {
+       if (! (and_with->flags & ANYOF_UNICODE_ALL)) {
+           cl->flags &= ~ANYOF_UNICODE_ALL;
+       }
        cl->flags |= and_with->flags & ANYOF_NONBITMAP; /* field is 2 bits; use
                                                           only the one(s)
                                                           actually set */