[C++ PATCH] Prevent -Wmaybe-uninitialized warning (PR sanitizer/67867)

Marek Polacek polacek@redhat.com
Tue Oct 6 17:31:00 GMT 2015


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



More information about the Gcc-patches mailing list