[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#195388: marked as done (libstdc++5-3.3-dev: erase()ing end() not harmless)



Your message dated Sat, 31 May 2003 11:28:42 +0200
with message-id <16088.30154.967783.560707@gargle.gargle.HOWL>
and subject line Bug#195388: 
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 30 May 2003 10:21:35 +0000
>From hvr@se-linux.ifs.tuwien.ac.at Fri May 30 05:21:34 2003
Return-path: <hvr@se-linux.ifs.tuwien.ac.at>
Received: from isync.ifs.tuwien.ac.at (se-linux.ifs.tuwien.ac.at) [128.130.204.18] 
	by master.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 19Lh0w-000460-00; Fri, 30 May 2003 05:21:34 -0500
Received: from lfdux.ifs.tuwien.ac.at (lfdux.ifs.tuwien.ac.at [128.130.204.22])
	by se-linux.ifs.tuwien.ac.at (8.12.3/8.12.3/Debian-6.4) with ESMTP id h4UALW6O015834;
	Fri, 30 May 2003 12:21:32 +0200
Received: from hvr by lfdux.ifs.tuwien.ac.at with local (Exim 3.36 #1 (Debian))
	id 19Lh0u-0003wE-00; Fri, 30 May 2003 12:21:32 +0200
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Herbert Valerio Riedel <hvr@se-linux.ifs.tuwien.ac.at>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: libstdc++5-3.3-dev: erase()ing end() not harmless
X-Mailer: reportbug 2.10.1
Date: Fri, 30 May 2003 12:21:32 +0200
Message-Id: <[🔎] E19Lh0u-0003wE-00@lfdux.ifs.tuwien.ac.at>
Delivered-To: submit@bugs.debian.org
X-Spam-Status: No, hits=-6.0 required=4.0
	tests=BAYES_01,HAS_PACKAGE
	version=2.53-bugs.debian.org_2003_05_24
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.53-bugs.debian.org_2003_05_24 (1.174.2.15-2003-03-30-exp)

Package: libstdc++5-3.3-dev
Version: 1:3.3-2
Severity: normal


...according to TC++PL 3rd ed, section 17.4.1.7, 
"Erasing end() is harmless."

but the following code either hangs or crashes when the end() iterator
is being passed to erase();

*** set_erase.cc
#include <set>
#include <map>
#include <cassert>

int 
main(int, char *[])
{
  std::set<int> s;

  s.insert (1); s.insert (2);
  s.insert (1); s.insert (2);

  assert (s.count (1) == 1);
  assert (s.count (2) == 1);

  s.erase (1);
  assert (s.count (1) == 0); assert (s.find (1) == s.end ());
  assert (s.count (2) == 1); assert (s.find (2) != s.end ());
  
  s.erase (s.find (2));
  assert (s.count (2) == 0); assert (s.find (2) == s.end ());

  s.erase (s.find (2)); // fails
  assert (s.count (2) == 0); assert (s.find (2) == s.end ());


  std::map<int,int> m;

  m[1] = 1;
  m[2] = 2;

  assert (m.count (2) != 0); assert (m.find (2) != m.end ());
  
  m.erase (m.find (2));
  assert (m.count (2) == 0); assert (m.find (2) == m.end ());

  m.erase (m.find (2)); // fails
  assert (m.count (2) == 0); assert (m.find (2) == m.end ());
}


-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux lfdux.ifs.tuwien.ac.at 2.4.20-1-k7 #1 Sat Mar 22 15:17:52 EST 2003 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages libstdc++5-3.3-dev depends on:
ii  g++-3.3                       1:3.3-2    The GNU C++ compiler
ii  gcc-3.3-base                  1:3.3-2    The GNU Compiler Collection (base 
ii  libc6-dev                     2.3.1-17   GNU C Library: Development Librari
ii  libstdc++5                    1:3.3-2    The GNU Standard C++ Library v3

-- no debconf information


---------------------------------------
Received: (at 195388-done) by bugs.debian.org; 31 May 2003 09:33:19 +0000
>From doko@cs.tu-berlin.de Sat May 31 04:33:18 2003
Return-path: <doko@cs.tu-berlin.de>
Received: from mail.cs.tu-berlin.de [130.149.17.13] 
	by master.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 19M2jl-00060d-00; Sat, 31 May 2003 04:33:17 -0500
Received: from bolero.cs.tu-berlin.de (daemon@bolero.cs.tu-berlin.de [130.149.19.1])
	by mail.cs.tu-berlin.de (8.9.3/8.9.3) with ESMTP id LAA00739;
	Sat, 31 May 2003 11:28:43 +0200 (MET DST)
Received: (from doko@localhost)
	by bolero.cs.tu-berlin.de (8.11.6+Sun/8.9.3) id h4V9ShX29961;
	Sat, 31 May 2003 11:28:43 +0200 (MEST)
From: Matthias Klose <doko@cs.tu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <16088.30154.967783.560707@gargle.gargle.HOWL>
Date: Sat, 31 May 2003 11:28:42 +0200
To: Herbert Valerio Riedel <hvr@hvrlab.org>, 195388-done@bugs.debian.org
Subject: Re: Bug#195388: 
In-Reply-To: <[🔎] 1054309669.21315.1.camel@janus.txd.hvrlab.org>
References: <[🔎] 1054309669.21315.1.camel@janus.txd.hvrlab.org>
X-Mailer: VM 7.03 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid
Delivered-To: 195388-done@bugs.debian.org
X-Spam-Status: No, hits=-21.2 required=4.0
	tests=BAYES_20,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,
	      REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_VM
	autolearn=ham version=2.53-bugs.debian.org_2003_05_24
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.53-bugs.debian.org_2003_05_24 (1.174.2.15-2003-03-30-exp)

Done.

Herbert Valerio Riedel writes:
> 
> ...just found out, that this is a non-bug; please close this bug
> 
> http://www.research.att.com/~bs/3rd_printing11.html
> > pg 489 replace "Erasing end() is harmless." by "A call m.erase(b,e)
> > where e is m.end() is harmless (provided b refers to an element of m
> > or is m.end()). However, a call m.erase(p) where p is m.end() is a
> > serious error that could corrupt the container."



Reply to: