diff mbox

[C++] Fix use of uninitialized flag (PR c++/52312)

Message ID 20120220205838.GX18768@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Feb. 20, 2012, 8:58 p.m. UTC
Hi!

If processing_template_decl || processing_specialization,
check_literal_operator_args doesn't initialize *long_long_unsigned_p nor
*long_double_p, but the caller might use those.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux
plus tested the PR testcase under valgrind, ok for trunk?

2012-02-19  Jakub Jelinek  <jakub@redhat.com>

	PR c++/52312
	* typeck.c (check_literal_operator_args): Initialize *long_double_p
	and *long_long_unsigned_p even if processing_template_decl.


	Jakub

Comments

Jason Merrill Feb. 20, 2012, 10:47 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

--- gcc/cp/typeck.c.jj	2012-01-20 12:35:11.000000000 +0100
+++ gcc/cp/typeck.c	2012-02-19 20:29:00.319526480 +0100
@@ -8483,6 +8483,9 @@  check_literal_operator_args (const_tree
 			     bool *long_long_unsigned_p, bool *long_double_p)
 {
   tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl));
+
+  *long_long_unsigned_p = false;
+  *long_double_p = false;
   if (processing_template_decl || processing_specialization)
     return argtypes == void_list_node;
   else
@@ -8491,9 +8494,6 @@  check_literal_operator_args (const_tree
       int arity;
       int max_arity = 2;
 
-      *long_long_unsigned_p = false;
-      *long_double_p = false;
-
       /* Count the number and type of arguments and check for ellipsis.  */
       for (argtype = argtypes, arity = 0;
 	   argtype && argtype != void_list_node;