From 7de068a892e9f41c20a4da66d7c7d360cdfb719a Mon Sep 17 00:00:00 2001 From: Volker Reichelt Date: Fri, 21 Jan 2005 16:21:39 +0000 Subject: [PATCH] re PR libstdc++/19510 ([3.3 only] Uninitialized pointers in iterators) PR libstdc++/19510 * include/bits/stl_list.h (_List_iterator): Initialize _M_node in constructor. (_List_const_iterator): Likewise. * include/bits/stl_tree.h (_Rb_tree_iterator): Likewise. (_Rb_tree_const_iterator): Likewise. * testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. From-SVN: r94017 --- libstdc++-v3/ChangeLog | 12 ++++++++++++ libstdc++-v3/include/bits/stl_list.h | 8 +++++--- libstdc++-v3/include/bits/stl_tree.h | 6 ++++-- .../testsuite/23_containers/map/operators/1_neg.cc | 4 ++-- .../testsuite/23_containers/set/operators/1_neg.cc | 5 ++--- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3ba85e2ab281..588fa8edb7c0 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,15 @@ +2005-01-21 Volker Reichelt + + PR libstdc++/19510 + * include/bits/stl_list.h (_List_iterator): Initialize _M_node + in constructor. + (_List_const_iterator): Likewise. + * include/bits/stl_tree.h (_Rb_tree_iterator): Likewise. + (_Rb_tree_const_iterator): Likewise. + + * testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers. + * testsuite/23_containers/set/operators/1_neg.cc: Likewise. + 2005-01-18 Paolo Carlini * include/bits/stl_tree.h: Add a few missing std:: qualifications. diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index 060755a213c8..afb118bb31e5 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -1,6 +1,6 @@ // List implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005 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 @@ -119,7 +119,8 @@ namespace _GLIBCXX_STD typedef _Tp* pointer; typedef _Tp& reference; - _List_iterator() { } + _List_iterator() + : _M_node() { } _List_iterator(_List_node_base* __x) : _M_node(__x) { } @@ -195,7 +196,8 @@ namespace _GLIBCXX_STD typedef const _Tp* pointer; typedef const _Tp& reference; - _List_const_iterator() { } + _List_const_iterator() + : _M_node() { } _List_const_iterator(const _List_node_base* __x) : _M_node(__x) { } diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 6001a3173d58..cea16f12d259 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -161,7 +161,8 @@ namespace std typedef _Rb_tree_node_base::_Base_ptr _Base_ptr; typedef _Rb_tree_node<_Tp>* _Link_type; - _Rb_tree_iterator() { } + _Rb_tree_iterator() + : _M_node() { } _Rb_tree_iterator(_Link_type __x) : _M_node(__x) { } @@ -231,7 +232,8 @@ namespace std typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr; typedef const _Rb_tree_node<_Tp>* _Link_type; - _Rb_tree_const_iterator() { } + _Rb_tree_const_iterator() + : _M_node() { } _Rb_tree_const_iterator(_Link_type __x) : _M_node(__x) { } diff --git a/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc b/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc index 64a1d7df866d..66417d34e1e2 100644 --- a/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc @@ -41,5 +41,5 @@ void test01() test &= itr == mapByName.end(); // { dg-error "no" } } -// { dg-error "candidates are" "" { target *-*-* } 209 } -// { dg-error "candidates are" "" { target *-*-* } 213 } +// { dg-error "candidates are" "" { target *-*-* } 210 } +// { dg-error "candidates are" "" { target *-*-* } 214 } diff --git a/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc b/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc index 8af78f30837e..f0601255ab7d 100644 --- a/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc @@ -39,6 +39,5 @@ void test01() test &= itr == setByName.end(); // { dg-error "no" } } -// { dg-error "candidates are" "" { target *-*-* } 282 } -// { dg-error "candidates are" "" { target *-*-* } 286 } - +// { dg-error "candidates are" "" { target *-*-* } 284 } +// { dg-error "candidates are" "" { target *-*-* } 288 } -- 2.47.2