regcomp.c: Defer setting regnode operand
authorKarl Williamson <khw@cpan.org>
Sun, 14 Oct 2018 22:50:59 +0000 (16:50 -0600)
committerKarl Williamson <khw@cpan.org>
Sat, 20 Oct 2018 06:09:55 +0000 (00:09 -0600)
Don't set this until we know that we are actually going to have a
regnode that requires this operand.

regcomp.c

index 36c59c9..290f8b4 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -18025,10 +18025,6 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
 
     /****** !SIZE_ONLY (Pass 2) AFTER HERE *********/
 
-    if (posixl) {
-        ANYOF_POSIXL_SET_TO_BITMAP(REGNODE_p(ret), posixl);
-    }
-
     /* If folding, we calculate all characters that could fold to or from the
      * ones already on the list */
     if (cp_foldable_list) {
@@ -18724,6 +18720,10 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
 
     populate_ANYOF_from_invlist(REGNODE_p(ret), &cp_list);
 
+    if (posixl) {
+        ANYOF_POSIXL_SET_TO_BITMAP(REGNODE_p(ret), posixl);
+    }
+
     if (invert) {
         ANYOF_FLAGS(REGNODE_p(ret)) |= ANYOF_INVERT;
     }