Subject: Re: bug#22655: grep -Pz '^' now fails!

From: Paul Eggert <[email-masked]>
Date: Sat, 19 Nov 2016 01:37:18 -0800

Zev Weiss wrote:
> I see 'reflags' being tested in Pexecute(), but I don't see it getting set anywhere

Oops, that somehow got lost during merging. Thanks for catching that. Omitting 
the initialization caused hurt performance due to a failure to use 
PCRE_MULTILINE but did not cause a correctness bug, so the tests didn't catch 
it. Fixed with the attached patch.
>From 5b01c4c11cca603c165c3166d2a7566a8505074c Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sat, 19 Nov 2016 01:33:48 -0800
Subject: [PATCH] grep: fix performance typo with -P

Reported by Zev Weiss in: http://bugs.gnu.org/22655#88
* src/pcresearch.c (Pcompile): Initialize reflags.
---
 src/pcresearch.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/pcresearch.c b/src/pcresearch.c
index 9a13d97..439945a 100644
--- a/src/pcresearch.c
+++ b/src/pcresearch.c
@@ -176,6 +176,7 @@ Pcompile (char const *pattern, size_t size)
   if (match_lines)
     strcpy (n, xsuffix);
 
+  reflags = flags;
   cre = pcre_compile (re, flags, &ep, &e, pcre_maketables ());
   if (!cre)
     die (EXIT_TROUBLE, 0, "%s", ep);
-- 
2.7.4