public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/60587] New: debug-mode -std=c++11 vector::insert(pos, begin, end) dereferences begin too eagerly
@ 2014-03-19 14:09 sbergman at redhat dot com
  2014-03-21 18:54 ` [Bug libstdc++/60587] [4.9 Regression] " redi at gcc dot gnu.org
  2014-03-21 18:55 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: sbergman at redhat dot com @ 2014-03-19 14:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60587

            Bug ID: 60587
           Summary: debug-mode -std=c++11 vector::insert(pos, begin, end)
                    dereferences begin too eagerly
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sbergman at redhat dot com

At least on recent trunk (r208675),

> $ cat test.cc
> #define _GLIBCXX_DEBUG
> #include <vector>
> int main() {
>     std::vector<int> a, b;
>     a.push_back(1);
>     a.insert(a.end(), b.begin(), b.end());
> }
> $ ~/gcc/trunk/inst/g++ -std=c++11 test.cc
> $ ./a.out
> ~/gcc/trunk/inst/include/c++/4.9.0/debug/safe_iterator.h:261:
>     error: attempt to dereference a past-the-end iterator.
>
> Objects involved in the operation:
> iterator "this" @ 0x0x7fff0d764060 {
> type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPiNSt9__cxx19986vectorIiSaIiEEEEENSt7__debug6vectorIiS6_EEEE (mutable iterator);
>   state = past-the-end;
>   references sequence with type `NSt7__debug6vectorIiSaIiEEE' @ 0x0x7fff0d764be0
> }

which

> Index: libstdc++-v3/include/debug/macros.h
> ===================================================================
> --- libstdc++-v3/include/debug/macros.h	(revision 208675)
> +++ libstdc++-v3/include/debug/macros.h	(working copy)
> @@ -106,7 +106,7 @@
>  #define __glibcxx_check_insert_range(_Position,_First,_Last)		\
>  __glibcxx_check_valid_range(_First,_Last);				\
>  __glibcxx_check_insert(_Position);					\
> -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__foreign_iterator(_Position,_First),\
> +_GLIBCXX_DEBUG_VERIFY(_First==_Last||__gnu_debug::__foreign_iterator(_Position,_First),\
>  		      _M_message(__gnu_debug::__msg_insert_range_from_self)\
>  		      ._M_iterator(_First, #_First)			\
>  		      ._M_iterator(_Last, #_Last)			\

works around for me.
>From gcc-bugs-return-446876-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Mar 19 14:11:23 2014
Return-Path: <gcc-bugs-return-446876-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17979 invoked by alias); 19 Mar 2014 14:11:23 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 17955 invoked by uid 48); 19 Mar 2014 14:11:19 -0000
From: "senthil_kumar.selvaraj at atmel dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/60588] New: AVR target does not support init_priority attribute
Date: Wed, 19 Mar 2014 14:11:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: senthil_kumar.selvaraj at atmel dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-60588-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-03/txt/msg01745.txt.bz2
Content-length: 678

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`588

            Bug ID: 60588
           Summary: AVR target does not support init_priority attribute
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: senthil_kumar.selvaraj at atmel dot com

The AVR target does not support init_priority attribute. This makes it hard to
control initialization order of global objects across translation units.

Was originally requested at
http://lists.nongnu.org/archive/html/avr-gcc-list/2014-03/msg00005.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libstdc++/60587] [4.9 Regression] debug-mode -std=c++11 vector::insert(pos, begin, end) dereferences begin too eagerly
  2014-03-19 14:09 [Bug libstdc++/60587] New: debug-mode -std=c++11 vector::insert(pos, begin, end) dereferences begin too eagerly sbergman at redhat dot com
@ 2014-03-21 18:54 ` redi at gcc dot gnu.org
  2014-03-21 18:55 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-21 18:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60587

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Fri Mar 21 18:54:06 2014
New Revision: 208755

URL: http://gcc.gnu.org/viewcvs?rev=208755&root=gcc&view=rev
Log:
    PR libstdc++/60587
    * include/debug/functions.h (_Is_contiguous_sequence): Define.
    (__foreign_iterator): Accept additional iterator. Do not dispatch on
    iterator category.
    (__foreign_iterator_aux2): Likewise. Add overload for iterators
    from different types of debug container. Use _Is_contiguous_sequence
    instead of is_lvalue_reference.
    (__foreign_iterator_aux3): Accept additional iterator. Avoid
    dereferencing past-the-end iterator.
    (__foreign_iterator_aux4): Use const value_type* instead of
    potentially user-defined const_pointer type.
    * include/debug/macros.h (__glibcxx_check_insert_range): Fix comment
    and pass end iterator to __gnu_debug::__foreign_iterator.
    (__glibcxx_check_insert_range_after): Likewise.
    (__glibcxx_check_max_load_factor): Fix comment.
    * include/debug/vector (_Is_contiguous_sequence): Define partial
    specializations.
    * testsuite/23_containers/vector/debug/57779_neg.cc: Remove
    -std=gnu++11 option and unused header.
    * testsuite/23_containers/vector/debug/60587.cc: New.
    * testsuite/23_containers/vector/debug/60587_neg.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/23_containers/vector/debug/60587.cc
      - copied, changed from r208753,
trunk/libstdc++-v3/testsuite/23_containers/vector/debug/57779_neg.cc
    trunk/libstdc++-v3/testsuite/23_containers/vector/debug/60587_neg.cc
      - copied, changed from r208753,
trunk/libstdc++-v3/testsuite/23_containers/vector/debug/57779_neg.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/debug/functions.h
    trunk/libstdc++-v3/include/debug/macros.h
    trunk/libstdc++-v3/include/debug/vector
    trunk/libstdc++-v3/testsuite/23_containers/vector/debug/57779_neg.cc


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libstdc++/60587] [4.9 Regression] debug-mode -std=c++11 vector::insert(pos, begin, end) dereferences begin too eagerly
  2014-03-19 14:09 [Bug libstdc++/60587] New: debug-mode -std=c++11 vector::insert(pos, begin, end) dereferences begin too eagerly sbergman at redhat dot com
  2014-03-21 18:54 ` [Bug libstdc++/60587] [4.9 Regression] " redi at gcc dot gnu.org
@ 2014-03-21 18:55 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-21 18:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60587

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed (with a rather more complicated patch!)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-21 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-19 14:09 [Bug libstdc++/60587] New: debug-mode -std=c++11 vector::insert(pos, begin, end) dereferences begin too eagerly sbergman at redhat dot com
2014-03-21 18:54 ` [Bug libstdc++/60587] [4.9 Regression] " redi at gcc dot gnu.org
2014-03-21 18:55 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).