summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regcomp.c1
-rw-r--r--t/op/threads.t19
2 files changed, 18 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index 03d11126e1..0c503e9f8a 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -9458,7 +9458,6 @@ Perl_re_dup_guts(pTHX_ const REGEXP *sstr, REGEXP *dstr, CLONE_PARAMS *param)
ret->mother_re = NULL;
ret->gofs = 0;
- ret->seen_evals = 0;
}
#endif /* PERL_IN_XSUB_RE */
diff --git a/t/op/threads.t b/t/op/threads.t
index 46799290a1..814b59550f 100644
--- a/t/op/threads.t
+++ b/t/op/threads.t
@@ -16,7 +16,7 @@ BEGIN {
exit 0;
}
- plan(12);
+ plan(13);
}
use strict;
@@ -169,4 +169,21 @@ threads->new(\&matchit, "Pie", qr/pie/i)->join();
# tests in threads don't get counted, so
curr_test(curr_test() + 2);
+
+# the seen_evals field of a regexp was getting zeroed on clone, so
+# within a thread it didn't know that a regex object contrained a 'safe'
+# re_eval expression, so it later died with 'Eval-group not allowed' when
+# you tried to interpolate the object
+
+sub safe_re {
+ my $re = qr/(?{1})/; # this is literal, so safe
+ eval { "a" =~ /$re$re/ }; # interpolating safe values, so safe
+ ok($@ eq "", 'clone seen-evals');
+}
+threads->new(\&safe_re)->join();
+
+# tests in threads don't get counted, so
+curr_test(curr_test() + 1);
+
+
# EOF