This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix cp_parser_braced_list
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 4 Mar 2013 22:22:40 +0100
- Subject: [PATCH] Fix cp_parser_braced_list
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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 <jakub@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