summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/util.c b/util.c
index 1c90fb0b6f..1c68f3d50b 100644
--- a/util.c
+++ b/util.c
@@ -552,6 +552,13 @@ Perl_fbm_compile(pTHX_ SV *sv, U32 flags)
PERL_ARGS_ASSERT_FBM_COMPILE;
+ /* Refuse to fbm_compile a studied scalar, as this gives more flexibility in
+ SV flag usage. No real-world code would ever end up using a studied
+ scalar as a compile-time second argument to index, so this isn't a real
+ pessimisation. */
+ if (SvSCREAM(sv))
+ return;
+
if (flags & FBMcf_TAIL) {
MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_utf8) : NULL;
sv_catpvs(sv, "\n"); /* Taken into account in fbm_instr() */