or diag $@;
}
+# This is more a test of fbm_compile/pp_study (non) interaction than dumping
+# prowess, but short of duplicating all the gubbins of this file, I can't see
+# a way to make a better place for it:
+
use constant {
perl => 'rules',
beer => 'foamy',
do_test('regular string constant', perl,
'SV = PV\\($ADDR\\) at $ADDR
- REFCNT = 3
+ REFCNT = 5
FLAGS = \\(PADMY,POK,READONLY,pPOK\\)
PV = $ADDR "rules"\\\0
CUR = 5
do_test('string constant now an FBM', perl,
'SV = PVGV\\($ADDR\\) at $ADDR
- REFCNT = 3
+ REFCNT = 5
+ FLAGS = \\(PADMY,SMG,POK,READONLY,pPOK,VALID,EVALED\\)
+ PV = $ADDR "rules"\\\0
+ CUR = 5
+ LEN = \d+
+ MAGIC = $ADDR
+ MG_VIRTUAL = &PL_vtbl_bm
+ MG_TYPE = PERL_MAGIC_bm\\(B\\)
+ FLAGS = 0
+ RARE = \d+
+ PREVIOUS = 1
+ USEFUL = 100
+');
+
+ is(study perl, '', "Not allowed to study an FBM");
+
+ do_test('string constant still an FBM', perl,
+'SV = PVGV\\($ADDR\\) at $ADDR
+ REFCNT = 5
FLAGS = \\(PADMY,SMG,POK,READONLY,pPOK,VALID,EVALED\\)
PV = $ADDR "rules"\\\0
CUR = 5
RETPUSHYES;
}
s = (unsigned char*)(SvPV(sv, len));
- if (len == 0 || len > I32_MAX || !SvPOK(sv) || SvUTF8(sv)) {
+ if (len == 0 || len > I32_MAX || !SvPOK(sv) || SvUTF8(sv) || SvVALID(sv)) {
/* No point in studying a zero length string, and not safe to study
anything that doesn't appear to be a simple scalar (and hence might
change between now and when the regexp engine runs without our set
magic ever running) such as a reference to an object with overloaded
- stringification. */
+ stringification. Also refuse to study an FBM scalar, as this gives
+ more flexibility in SV flag usage. No real-world code would ever
+ end up studying an FBM scalar, so this isn't a real pessimisation.
+ */
RETPUSHNO;
}
pos = len;