This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Silence compiler warning msg.
authorKarl Williamson <khw@cpan.org>
Mon, 4 Mar 2019 18:28:13 +0000 (11:28 -0700)
committerKarl Williamson <khw@cpan.org>
Mon, 4 Mar 2019 18:38:09 +0000 (11:38 -0700)
Some compilers aren't smart enough to realize there is no path through
this function that doesn't set the return value.  So initialize to an
illegal value.

Spotted by atoomic

regcomp.c

index 5bae668..5cb8c6a 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -16478,7 +16478,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
     UV prevvalue = OOB_UNICODE, save_prevvalue = OOB_UNICODE;
     IV range = 0;
     UV value = OOB_UNICODE, save_value = OOB_UNICODE;
-    regnode_offset ret;
+    regnode_offset ret = -1;    /* Initialized to an illegal value */
     STRLEN numlen;
     int namedclass = OOB_NAMEDCLASS;
     char *rangebegin = NULL;