This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Silence uninit compiler warning
authorKarl Williamson <khw@cpan.org>
Mon, 19 Feb 2018 19:14:06 +0000 (12:14 -0700)
committerKarl Williamson <khw@cpan.org>
Tue, 20 Feb 2018 03:47:10 +0000 (20:47 -0700)
This warning (only known on one compiler at the moment) is probably
wrong, but by setting this to NULL, we avoid the warning, and should
segfault if the warning were correct, instead of using uninitialized
data.

regcomp.c

index a3fadf6..8f55141 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -10689,7 +10689,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
      * RExC_parse beyond the '('.  Things like '(?' are indivisible tokens, and
      * this flag alerts us to the need to check for that */
 {
-    regnode *ret;              /* Will be the head of the group. */
+    regnode *ret = NULL;    /* Will be the head of the group. */
     regnode *br;
     regnode *lastbr;
     regnode *ender = NULL;