Hi!

As reported by valgrind, cp_parser_braced_list doesn't initialize
*non_constant_p when seeing just {}, and thus when e.g. cp_parser_condition
calls it, non_constant_p is uninitialized when cp_finish_decl
is called with !non_constant_p.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2013-03-04  Jakub Jelinek  <ja...@redhat.com>

        * parser.c (cp_parser_braced_list): For {} initialize
        *non_constant_p to false.

--- gcc/cp/parser.c.jj  2013-02-14 09:37:16.000000000 +0100
+++ gcc/cp/parser.c     2013-03-04 19:14:00.629442603 +0100
@@ -17854,6 +17854,8 @@ cp_parser_braced_list (cp_parser* parser
       if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
        cp_lexer_consume_token (parser->lexer);
     }
+  else
+    *non_constant_p = false;
   /* Now, there should be a trailing `}'.  */
   cp_parser_require (parser, CPP_CLOSE_BRACE, RT_CLOSE_BRACE);
   TREE_TYPE (initializer) = init_list_type_node;

        Jakub

Reply via email to