From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5854 invoked by alias); 24 May 2002 03:26:03 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 5826 invoked by uid 71); 24 May 2002 03:26:02 -0000 Resent-Date: 24 May 2002 03:26:02 -0000 Resent-Message-ID: <20020524032602.5824.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, vograno@arbitrade.com Received:(qmail 2902 invoked by uid 61); 24 May 2002 03:18:25 -0000 Message-Id:<20020524031825.2901.qmail@sources.redhat.com> Date: Thu, 23 May 2002 20:26:00 -0000 From: vograno@arbitrade.com Reply-To: vograno@arbitrade.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: libstdc++/6791: hash_map: bad end() iterator X-SW-Source: 2002-05/txt/msg00755.txt.bz2 List-Id: >Number: 6791 >Category: libstdc++ >Synopsis: hash_map: bad end() iterator >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu May 23 20:26:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Vadim Ogranovich >Release: gcc version 3.0.4 >Organization: >Environment: Linux >Description: The following program produces a segmentation fault. It works fine if map is used instead of hash_map. Note also that a number of calls to the destructor ~Foo() exceeds the number of constructor calls (not a bug per se, but looks strage). //file foo.cpp #include #include #include using namespace std; class Foo { public: Foo() { cerr << "constructed\n"; } ~Foo() { cerr << "destructed\n"; } }; typedef hash_map HT; int main() { HT fooH; fooH[0] = Foo(); for (HT::iterator iter=fooH.begin(); iter!=fooH.end(); ++iter) { cerr << "erasing\n"; fooH.erase(iter); } return 0; } >How-To-Repeat: save to foo.cpp compile: g++ -g foo.cpp -o foo run: ./foo >Fix: >Release-Note: >Audit-Trail: >Unformatted: