From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32923 invoked by alias); 10 Apr 2018 19:58:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 32775 invoked by uid 89); 10 Apr 2018 19:58:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 spammy=Hx-languages-length:1728, H*f:sk:2018022 X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Apr 2018 19:58:16 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C58C3722E9; Tue, 10 Apr 2018 19:58:14 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 368F02026DFD; Tue, 10 Apr 2018 19:58:14 +0000 (UTC) Date: Tue, 10 Apr 2018 19:58:00 -0000 From: Jan Kratochvil To: Simon Marchi Cc: gdb-patches@sourceware.org Subject: Regression with -D_GLIBCXX_DEBUG [Re: [PATCH 1/5] Make delim_string_to_char_ptr_vec return an std::vector] Message-ID: <20180410195811.GA16998@host1.jankratochvil.net> References: <20180225163247.20157-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180225163247.20157-1-simon.marchi@polymtl.ca> User-Agent: Mutt/1.9.2 (2017-12-15) X-SW-Source: 2018-04/txt/msg00191.txt.bz2 Hi, commit e80aaf6183c6692ecc167bf26cbdc53f8f1a55f0 (HEAD) Author: Simon Marchi Date: Fri Mar 2 23:22:06 2018 -0500 Make delim_string_to_char_ptr_vec return an std::vector /usr/include/c++/7/debug/safe_iterator.h:297: Error: attempt to increment a singular iterator. Objects involved in the operation: iterator "this" @ 0x0x7fffffffd140 { type = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator >*, std::__cxx1998::vector >, std::allocator > > > >, std::__debug::vector >, std::allocator > > > > (mutable iterator); state = singular; references sequence with type 'std::__debug::vector >, std::allocator > > >' @ 0x0x265db40 } #4 0x000000000078f893 in auto_load_safe_path_vec_update () at auto-load.c:212 On Sun, 25 Feb 2018 17:32:43 +0100, Simon Marchi wrote: > /* Apply tilde_expand and gdb_realpath to each AUTO_LOAD_SAFE_PATH_VEC > element. */ > - for (ix = 0; ix < len; ix++) > + for (gdb::unique_xmalloc_ptr &in_vec : auto_load_safe_path_vec) > { ... > - VEC_safe_push (char_ptr, auto_load_safe_path_vec, > - real_path.release ()); > + auto_load_safe_path_vec.push_back (std::move (real_path)); > } > } > } The iterator breaks when moving its std::vector data underneath it. This is why the original C code did not use a pointer there. Jan