In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/bc18b9df70cc60cdfa7dd6e64d25e960792a0bf3?hp=923e23bad0514e1bd29112650fb78aa4ea69e1b7>

- Log -----------------------------------------------------------------
commit bc18b9df70cc60cdfa7dd6e64d25e960792a0bf3
Author: Yves Orton <demer...@gmail.com>
Date:   Sat Jan 28 16:20:35 2017 +0100

    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.
-----------------------------------------------------------------------

Summary of changes:
 regcomp.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/regcomp.c b/regcomp.c
index d5ce63fe27..19ed866f84 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -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 );
     }
 

--
Perl5 Master Repository

Reply via email to