summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--op_reg_common.h4
-rw-r--r--regcomp.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/op_reg_common.h b/op_reg_common.h
index 4e173504c5..f35cb7d233 100644
--- a/op_reg_common.h
+++ b/op_reg_common.h
@@ -85,6 +85,10 @@ get_regex_charset(const U32 flags)
* re->extflags during compilation */
#define RXf_PMf_COMPILETIME (RXf_PMf_MULTILINE|RXf_PMf_SINGLELINE|RXf_PMf_CHARSET|RXf_PMf_FOLD|RXf_PMf_EXTENDED|RXf_PMf_KEEPCOPY)
+#if RXf_PMf_COMPILETIME > 255
+# error RXf_PMf_COMPILETIME wont fit in U8 flags field of eval node
+#endif
+
/* These copies need to be numerical or defsubs_h.PL won't know about them. */
#define PMf_MULTILINE 1<<0
#define PMf_SINGLELINE 1<<1
diff --git a/regcomp.c b/regcomp.c
index cb98e624a9..038a4a6c27 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -8613,7 +8613,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
if (!SIZE_ONLY) {
ret->flags = 2;
/* for later propagation into (??{}) return value */
- eval->flags = (RExC_flags & RXf_PMf_COMPILETIME);
+ eval->flags = (U8) (RExC_flags & RXf_PMf_COMPILETIME);
}
REGTAIL(pRExC_state, ret, eval);
/* deal with the length of this later - MJD */