public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix cp_parser_braced_list
@ 2013-03-04 21:22 Jakub Jelinek
  2013-03-05 14:10 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2013-03-04 21:22 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix cp_parser_braced_list
  2013-03-04 21:22 [PATCH] Fix cp_parser_braced_list Jakub Jelinek
@ 2013-03-05 14:10 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2013-03-05 14:10 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

OK.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-05 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-04 21:22 [PATCH] Fix cp_parser_braced_list Jakub Jelinek
2013-03-05 14:10 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).