diff options
author | Yves Orton <demerphq@gmail.com> | 2017-01-28 16:20:35 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2017-01-28 16:20:35 +0100 |
commit | bc18b9df70cc60cdfa7dd6e64d25e960792a0bf3 (patch) | |
tree | 479952bbfc850af4c4818709b3d6a87bfe869561 /regcomp.c | |
parent | 923e23bad0514e1bd29112650fb78aa4ea69e1b7 (diff) | |
download | perl-bc18b9df70cc60cdfa7dd6e64d25e960792a0bf3.tar.gz |
assert that the RExC_recurse data structure points at a valid GOSUB
This assert will fail if someone adds code that optimises away a GOSUB
call. At which point they will see the comment and know what to do.
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -7789,6 +7789,18 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count, while ( RExC_recurse_count > 0 ) { const regnode *scan = RExC_recurse[ --RExC_recurse_count ]; + /* + * This data structure is set up in study_chunk() and is used + * to calculate the distance between a GOSUB regopcode and + * the OPEN/CURLYM (CURLYM's are special and can act like OPEN's) + * it refers to. + * + * If for some reason someone writes code that optimises + * away a GOSUB opcode then the assert should be changed to + * an if(scan) to guard the ARG2L_SET() - Yves + * + */ + assert(scan && OP(scan) == GOSUB); ARG2L_SET( scan, RExC_open_parens[ARG(scan)] - scan ); } |