This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Prevent -Wmaybe-uninitialized warning (PR sanitizer/67867)
- From: Marek Polacek <polacek at redhat dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Tue, 6 Oct 2015 19:31:34 +0200
- Subject: [C++ PATCH] Prevent -Wmaybe-uninitialized warning (PR sanitizer/67867)
- Authentication-results: sourceware.org; auth=none
This ought to kill a -Wmaybe-uninitialized warning which can be
seen when doing a bootstrap-ubsan -- which then duly fails.
Bootstrapped/regtested on x86_64-linux, ok for trunk?
2015-10-06 Marek Polacek <polacek@redhat.com>
PR sanitizer/67867
* search.c (accessible_p): Initialize OTYPE to NULL_TREE.
diff --git gcc/cp/search.c gcc/cp/search.c
index 508e66c..56bb266 100644
--- gcc/cp/search.c
+++ gcc/cp/search.c
@@ -961,7 +961,7 @@ accessible_p (tree type, tree decl, bool consider_local_p)
&& (!processing_template_parmlist || processing_template_decl > 1))
return 1;
- tree otype;
+ tree otype = NULL_TREE;
if (!TYPE_P (type))
{
/* When accessing a non-static member, the most derived type in the
Marek