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

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).