This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #123870] fixup trie runtime debug output
authorHugo van der Sanden <hv@crypt.org>
Wed, 18 Feb 2015 10:55:15 +0000 (10:55 +0000)
committerHugo van der Sanden <hv@crypt.org>
Wed, 18 Feb 2015 11:15:22 +0000 (11:15 +0000)
The trie_words av may not exist if -Dr was not enabled at compile time,
so we must be more defensive for debug output at runtime.

regexec.c

index b92b1b0..a4fea0a 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -4422,8 +4422,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
            DEBUG_EXECUTE_r({
                AV *const trie_words
                    = MUTABLE_AV(rexi->data->data[ARG(ST.me)+TRIE_WORDS_OFFSET]);
-               SV ** const tmp = av_fetch( trie_words,
-                   ST.nextword-1, 0 );
+               SV ** const tmp = trie_words
+                        ? av_fetch(trie_words, ST.nextword - 1, 0) : NULL;
                SV *sv= tmp ? sv_newmortal() : NULL;
 
                PerlIO_printf( Perl_debug_log,