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>
Sat, 19 Dec 2015 05:59:35 +0000 (22:59 -0700)
committerKarl Williamson <khw@cpan.org>
Sat, 19 Dec 2015 06:03:26 +0000 (23:03 -0700)
This shouldn't actually happen, and g++ under -O0 didn't flag it, but
gcc under -O2 does, so initialize to an illegal value

regcomp.c

index 68fcd2e..7a028fd 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -16132,7 +16132,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
     if (optimizable && cp_list && ! invert) {
         UV start, end;
         U8 op = END;  /* The optimzation node-type */
     if (optimizable && cp_list && ! invert) {
         UV start, end;
         U8 op = END;  /* The optimzation node-type */
-        int posix_class;
+        int posix_class = -1;   /* Illegal value */
         const char * cur_parse= RExC_parse;
 
         invlist_iterinit(cp_list);
         const char * cur_parse= RExC_parse;
 
         invlist_iterinit(cp_list);