Patchwork [v3] libstdc++/55413

login
register
mail settings
Submitter Paolo Carlini
Date Nov. 20, 2012, 2:58 p.m.
Message ID <50AB9AB0.7020408@oracle.com>
Download mbox | patch
Permalink /patch/200367/
State New
Headers show

Comments

Paolo Carlini - Nov. 20, 2012, 2:58 p.m.
Hi,

tested x86_64-linux, committed mainline and 4_7-branch.

Thanks,
Paolo.

////////////////////////
2012-11-20  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/55413
	* include/bits/hashtable.h (_Hashtable<>::_M_rehash_aux): Initialize
	__bbegin_bkt and __prev_bkt to avoid uninitialized warnings.
	* testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust
	dg-error line number.

Patch

Index: include/bits/hashtable.h
===================================================================
--- include/bits/hashtable.h	(revision 193662)
+++ include/bits/hashtable.h	(working copy)
@@ -1,7 +1,6 @@ 
 // hashtable.h header -*- C++ -*-
 
-// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
-// Free Software Foundation, Inc.
+// Copyright (C) 2007-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -1679,7 +1678,7 @@ 
       __bucket_type* __new_buckets = _M_allocate_buckets(__n);
       __node_type* __p = _M_begin();
       _M_before_begin()._M_nxt = nullptr;
-      std::size_t __bbegin_bkt;
+      std::size_t __bbegin_bkt = 0;
       while (__p)
 	{
 	  __node_type* __next = __p->_M_next();
@@ -1720,8 +1719,8 @@ 
 
       __node_type* __p = _M_begin();
       _M_before_begin()._M_nxt = nullptr;
-      std::size_t __bbegin_bkt;
-      std::size_t __prev_bkt;
+      std::size_t __bbegin_bkt = 0;
+      std::size_t __prev_bkt = 0;
       __node_type* __prev_p = nullptr;
       bool __check_bucket = false;
 
@@ -1749,8 +1748,8 @@ 
 	    {
 	      if (__check_bucket)
 		{
-		  // Check if we shall update the next bucket because of insertions
-		  // into __prev_bkt bucket.
+		  // Check if we shall update the next bucket because of
+		  // insertions into __prev_bkt bucket.
 		  if (__prev_p->_M_nxt)
 		    {
 		      std::size_t __next_bkt
Index: testsuite/23_containers/unordered_set/instantiation_neg.cc
===================================================================
--- testsuite/23_containers/unordered_set/instantiation_neg.cc	(revision 193652)
+++ testsuite/23_containers/unordered_set/instantiation_neg.cc	(working copy)
@@ -19,7 +19,7 @@ 
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-error "with noexcept" "" { target *-*-* } 248 }
+// { dg-error "with noexcept" "" { target *-*-* } 247 }
 
 #include <unordered_set>