public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/59713] New: unordered_map constructor / destructor / move
@ 2014-01-07 23:21 victor.robertson.iv at gmail dot com
  2014-01-09 17:36 ` [Bug libstdc++/59713] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: victor.robertson.iv at gmail dot com @ 2014-01-07 23:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59713
           Summary: unordered_map constructor / destructor / move
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: victor.robertson.iv at gmail dot com

Created attachment 31769
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31769&action=edit
intermediate files

Running the sample program produces the following:

a.out(49621,0x7fff7df24310) malloc: *** error for object 0x7fa472c03880:
pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

Sample program:

#include <unordered_map>

struct Foo : std::unordered_map<int,int> {
    using std::unordered_map<int, int>::unordered_map;
    // ~Foo() = default; // explicitly adding default destructor fixes the
problem
};

struct Bar {
    Bar(Foo f = {}) : _f(std::move(f)) {}
    // any of these constructors also work:
    // Bar(Foo f = Foo()) : _f(std::move(f)) {}
    // Bar(Foo f = {}) : _f(f) {}

    Foo _f;
};

int main() {
    Bar b;

    // The following code also works as expected
    // Foo f1 = {};
    // Foo f2 = std::move(f1);
}

Output from g++-4.9 -v:

Using built-in specs.
COLLECT_GCC=gcc-4.9
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc49/4.9-20131229/libexec/gcc/x86_64-apple-darwin13.0.0/4.9.0/lto-wrapper
Target: x86_64-apple-darwin13.0.0
Configured with: ../configure --build=x86_64-apple-darwin13.0.0
--prefix=/usr/local/Cellar/gcc49/4.9-20131229
--enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.9
--with-gmp=/usr/local/opt/gmp4 --with-mpfr=/usr/local/opt/mpfr2
--with-mpc=/usr/local/opt/libmpc08 --with-cloog=/usr/local/opt/cloog018
--with-isl=/usr/local/opt/isl011 --with-system-zlib
--enable-version-specific-runtime-libs --enable-libstdcxx-time=yes
--enable-stage1-checking --enable-checking=release --enable-lto
--disable-werror --enable-plugin --disable-nls --disable-multilib
Thread model: posix
gcc version 4.9.0 20131229 (experimental) (GCC) 

Compiler command: g++-4.9 -Wall -Wextra --std=c++11 gcctest.cpp
No compiler output during compilation.

I've attached the intermediate files as requested.


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

* [Bug libstdc++/59713] unordered_map constructor / destructor / move
  2014-01-07 23:21 [Bug libstdc++/59713] New: unordered_map constructor / destructor / move victor.robertson.iv at gmail dot com
@ 2014-01-09 17:36 ` redi at gcc dot gnu.org
  2014-01-09 17:53 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-09 17:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think this is a front-end issue, the temporary gets destroyed twice


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

* [Bug libstdc++/59713] unordered_map constructor / destructor / move
  2014-01-07 23:21 [Bug libstdc++/59713] New: unordered_map constructor / destructor / move victor.robertson.iv at gmail dot com
  2014-01-09 17:36 ` [Bug libstdc++/59713] " redi at gcc dot gnu.org
@ 2014-01-09 17:53 ` redi at gcc dot gnu.org
  2014-01-09 17:57 ` victor.robertson.iv at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-09 17:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-01-09
     Ever confirmed|0                           |1

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
bah, no it doesn't, my test was faulty. The same libstdc++ code compiled with
clang doesn't have any memory errors though.


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

* [Bug libstdc++/59713] unordered_map constructor / destructor / move
  2014-01-07 23:21 [Bug libstdc++/59713] New: unordered_map constructor / destructor / move victor.robertson.iv at gmail dot com
  2014-01-09 17:36 ` [Bug libstdc++/59713] " redi at gcc dot gnu.org
  2014-01-09 17:53 ` redi at gcc dot gnu.org
@ 2014-01-09 17:57 ` victor.robertson.iv at gmail dot com
  2014-01-09 18:05 ` [Bug c++/59713] " redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: victor.robertson.iv at gmail dot com @ 2014-01-09 17:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Victor Robertson <victor.robertson.iv at gmail dot com> ---
I was thinking that might be the case, I'll see if I can move the report to the
appropriate section.


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

* [Bug c++/59713] unordered_map constructor / destructor / move
  2014-01-07 23:21 [Bug libstdc++/59713] New: unordered_map constructor / destructor / move victor.robertson.iv at gmail dot com
                   ` (2 preceding siblings ...)
  2014-01-09 17:57 ` victor.robertson.iv at gmail dot com
@ 2014-01-09 18:05 ` redi at gcc dot gnu.org
  2014-01-10 23:37 ` victor.robertson.iv at gmail dot com
  2014-03-04 11:20 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-09 18:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I wasn't going to change the component until we've definitely ruled out
libstdc++ ... I'll keep looking into it


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

* [Bug c++/59713] unordered_map constructor / destructor / move
  2014-01-07 23:21 [Bug libstdc++/59713] New: unordered_map constructor / destructor / move victor.robertson.iv at gmail dot com
                   ` (3 preceding siblings ...)
  2014-01-09 18:05 ` [Bug c++/59713] " redi at gcc dot gnu.org
@ 2014-01-10 23:37 ` victor.robertson.iv at gmail dot com
  2014-03-04 11:20 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: victor.robertson.iv at gmail dot com @ 2014-01-10 23:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Victor Robertson <victor.robertson.iv at gmail dot com> ---
My apologies!

I'm not sure why I first thought it was with libstdc++, but after realizing
that just adding that explicitly defined default destructor fixed it, I
couldn't imagine it being the library.


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

* [Bug c++/59713] unordered_map constructor / destructor / move
  2014-01-07 23:21 [Bug libstdc++/59713] New: unordered_map constructor / destructor / move victor.robertson.iv at gmail dot com
                   ` (4 preceding siblings ...)
  2014-01-10 23:37 ` victor.robertson.iv at gmail dot com
@ 2014-03-04 11:20 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-04 11:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Bug 60367 has a better testcase and analysis

*** This bug has been marked as a duplicate of bug 60367 ***


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

end of thread, other threads:[~2014-03-04 11:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-07 23:21 [Bug libstdc++/59713] New: unordered_map constructor / destructor / move victor.robertson.iv at gmail dot com
2014-01-09 17:36 ` [Bug libstdc++/59713] " redi at gcc dot gnu.org
2014-01-09 17:53 ` redi at gcc dot gnu.org
2014-01-09 17:57 ` victor.robertson.iv at gmail dot com
2014-01-09 18:05 ` [Bug c++/59713] " redi at gcc dot gnu.org
2014-01-10 23:37 ` victor.robertson.iv at gmail dot com
2014-03-04 11:20 ` 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).