From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10407 invoked by alias); 19 May 2004 05:11:09 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 10383 invoked from network); 19 May 2004 05:11:07 -0000 Received: from unknown (HELO mgr2.xmission.com) (198.60.22.202) by sourceware.org with SMTP; 19 May 2004 05:11:07 -0000 Received: from [198.60.22.201] (helo=mgr1.xmission.com) by mgr2.xmission.com with esmtp (Exim 3.35 #1) id 1BQJMA-0000hY-02; Tue, 18 May 2004 23:11:06 -0600 Received: from [166.70.238.3] (helo=xmission.xmission.com) by mgr1.xmission.com with esmtp (Exim 4.30) id 1BQJM9-0004GR-Sn; Tue, 18 May 2004 23:11:05 -0600 Received: from llewelly by xmission.xmission.com with local (Exim 3.35 #1 (Debian)) id 1BQJM9-0007Rv-00; Tue, 18 May 2004 23:11:05 -0600 To: gcc-bugzilla@gcc.gnu.org Cc: gcc-bugs@gcc.gnu.org References: <20040518193757.15523.bangerth@dealii.org> From: llewelly@xmission.com Date: Wed, 19 May 2004 22:58:00 -0000 In-Reply-To: <20040518193757.15523.bangerth@dealii.org> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 MIME-Version: 1.0 Subject: Re: [Bug libstdc++/15523] New: Can't have vectors of vector::const_iterator Content-Type: text/plain; charset=us-ascii X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on mgr1.xmission.com X-Spam-Level: X-Spam-Status: No, hits=0.3 required=8.0 tests=NO_REAL_NAME autolearn=no version=2.63 X-SA-Exim-Mail-From: llewelly@xmission.com X-SA-Exim-Version: 3.1 (built Wed Aug 20 09:38:54 PDT 2003) X-SA-Exim-Scanned: Yes X-SW-Source: 2004-05/txt/msg02101.txt.bz2 List-Id: "bangerth at dealii dot org" writes: > I definitely like the debug mode in libstdc++, but happened to fall over this: > ----------------- > #include > > int main () > { > std::vector::const_iterator> x(2); > } > ----------------- > > When compiled with -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC, I got this: > > homes/csm2/bangerth/bin/gcc-3.4.0/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/debug/safe_iterator.h:125: > error: attempt to copy-construct an iterator from a singular iterator. > > Objects involved in the operation: > iterator "this" @ 0x0x8067ee0 { > type = > N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPKiN10__gnu_norm6vectorIiSaIiEEEEEN15__gnu_debug_def6vectorIiS7_EEEE > (constant iterator); > state = singular; > } > iterator "other" @ 0x0xbfffdd40 { > type = > N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPKiN10__gnu_norm6vectorIiSaIiEEEEEN15__gnu_debug_def6vectorIiS7_EEEE > (constant iterator); > state = singular; > } > > > For some reason, I fail to see why I shouldn't be allowed to copy-construct from an > invalid iterator. After all, the result would still be invalid and > couldn't be dereferenced, no? Copying an invalid iterator is undefined behavior. 24.1/5 . > I think this should be allowed. Is there a gcc target where (a) loading an invalid address into an address register causes a hardware fault, and (b) copy constructing an invalid iterator might require such a load?