This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix use of uninitialized flag (PR c++/52312)
- 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, 20 Feb 2012 21:58:38 +0100
- Subject: [C++ PATCH] Fix use of uninitialized flag (PR c++/52312)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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.
--- 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;
Jakub