diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2012-11-20 14:54:11 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2012-11-20 14:54:11 +0000 |
commit | 25caa91e991976d04f2f4a87ccf94a877ebefb46 (patch) | |
tree | 7a3a38415b64258ae6ff99ac88a171a00f666948 | |
parent | 3263c9a3a75081bac1020be3706665f84306c90e (diff) | |
download | gcc-25caa91e991976d04f2f4a87ccf94a877ebefb46.zip gcc-25caa91e991976d04f2f4a87ccf94a877ebefb46.tar.gz gcc-25caa91e991976d04f2f4a87ccf94a877ebefb46.tar.bz2 |
re PR libstdc++/55413 ([LTO] hashtable.h:1648 '__bbegin_bkt' may be used uninitialized in this function [-Werror=maybe-uninitialized])
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.
From-SVN: r193663
-rw-r--r-- | libstdc++-v3/ChangeLog | 8 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/hashtable.h | 13 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc | 2 |
3 files changed, 15 insertions, 8 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 58616cd..f0a34f8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +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. + 2012-11-20 Matthias Klose <doko@ubuntu.com> * doc/doxygen/user.cfg.in (ALIASES). Escape sharp braces. diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index 6242e20..fab6c7c 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -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 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __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 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __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 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { 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 diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc index f9e0b4f..e490fa3 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc @@ -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> |