This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR libstdc++/19510 on 3.3 branch


On 20 Jan, Gabriel Dos Reis wrote:
> Volker Reichelt <reichelt@igpm.rwth-aachen.de> writes:
>
> | OK if I prepare a patch for 3.3, too?
> 
> After you've applied to 3.4.x; yes.

Now that I committed the patches for mainline and the 3.4 branch,
here's the patch for the 3.3 branch.

A quick reminder: PR libstdc++/19510 is about iterators that contain
pointers which sometimes aren't initialized. Since copying ill-formed
pointers might trigger hardware traps on some systems, this is a problem.
The patch fixes that by providing missing default initializations.

Bootstrapped and regtested.

Ok to commit?

Regards,
Volker


2005-01-21  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR libstdc++/19510
	* include/bits/stl_list.h (_List_iterator_base): Initialize _M_node
	in constructor.
	(_List_iterator): Initialize _List_iterator_base in constructor.
	* include/bits/stl_tree.h (_Rb_tree_iterator): Initialize _M_node
	in constructor.

===================================================================
--- gcc/libstdc++-v3/include/bits/stl_list.h	10 Sep 2002 23:19:10 -0000	1.20
+++ gcc/libstdc++-v3/include/bits/stl_list.h	20 Jan 2005 19:38:23 -0000
@@ -1,6 +1,6 @@
 // List implementation -*- C++ -*-
 
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 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
@@ -108,6 +108,7 @@ namespace std
     { }
   
     _List_iterator_base()
+    : _M_node()
     { }
   
     /// Walk the %list forward.
@@ -156,6 +157,7 @@ namespace std
     { }
   
     _List_iterator()
+    : _List_iterator_base()
     { }
   
     _List_iterator(const iterator& __x)
===================================================================
--- gcc/libstdc++-v3/include/bits/stl_tree.h	22 Nov 2002 18:53:53 -0000	1.17
+++ gcc/libstdc++-v3/include/bits/stl_tree.h	20 Jan 2005 19:44:21 -0000
@@ -1,6 +1,6 @@
 // RB tree implementation -*- C++ -*-
 
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 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
@@ -191,7 +191,7 @@ namespace std
       typedef _Rb_tree_iterator<_Val, _Ref, _Ptr> _Self;
       typedef _Rb_tree_node<_Val>* _Link_type;
       
-      _Rb_tree_iterator() {}
+      _Rb_tree_iterator() { _M_node = 0; }
       _Rb_tree_iterator(_Link_type __x) { _M_node = __x; }
       _Rb_tree_iterator(const iterator& __it) { _M_node = __it._M_node; }
 
===================================================================



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]