summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-03-19 18:41:48 -0600
committerKarl Williamson <public@khwilliamson.com>2011-03-19 19:01:37 -0600
commit05dd4d395c6a14aeb23dbc107af579969b186caf (patch)
tree023409b902d699170fb759a250c881ddceb845d5
parent9d7a1e6315426819da0d6af6dc79fde72e9c8c08 (diff)
downloadperl-05dd4d395c6a14aeb23dbc107af579969b186caf.tar.gz
regcomp.c: RT#77414. Initialize flag
As indicated in the comments, this flag needs to be initialized to 1 or the optimizer loses the fact that something could match a character that isn't in utf8 and whose bitmap bit isn't set. This happens, for example, with Unicode properties. Thus this fixes #77414. That ticket had been closed recently because it went away due to another patch that caused the optimizer to be bypassed in the cases tested for. But when that patch was reverted, and cleaned-up, this bug came back. Now, I believe I have found the root cause.
-rw-r--r--regcomp.c10
-rw-r--r--t/re/pat.t1
2 files changed, 9 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index b48fb579b6..8797058f39 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -728,7 +728,15 @@ S_cl_anything(const RExC_state_t *pRExC_state, struct regnode_charclass_class *c
ANYOF_BITMAP_SETALL(cl);
cl->flags = ANYOF_CLASS|ANYOF_EOS|ANYOF_UNICODE_ALL
- |ANYOF_LOC_NONBITMAP_FOLD|ANYOF_NON_UTF8_LATIN1_ALL;
+ |ANYOF_LOC_NONBITMAP_FOLD|ANYOF_NON_UTF8_LATIN1_ALL
+ /* Even though no bitmap is in use here, we need to set
+ * the flag below so an AND with a node that does have one
+ * doesn't lose that one. The flag should get cleared if
+ * the other one doesn't; and the code in regexec.c is
+ * structured so this being set when not needed does no
+ * harm. It seemed a little cleaner to set it here than do
+ * a special case in cl_and() */
+ |ANYOF_NONBITMAP_NON_UTF8;
/* If any portion of the regex is to operate under locale rules,
* initialization includes it. The reason this isn't done for all regexes
diff --git a/t/re/pat.t b/t/re/pat.t
index b66d9393ac..4ef9663b5e 100644
--- a/t/re/pat.t
+++ b/t/re/pat.t
@@ -1030,7 +1030,6 @@ sub run_tests {
my $message = '\p property after empty * match';
{
- local $::TODO = "Bug 77414";
like("1", qr/\s*\pN/, $message);
like("-", qr/\s*\p{Dash}/, $message);
like(" ", qr/\w*\p{Blank}/, $message);