public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "victor.robertson.iv at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/59713] New: unordered_map constructor / destructor / move
Date: Tue, 07 Jan 2014 23:21:00 -0000	[thread overview]
Message-ID: <bug-59713-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2014-01-07 23:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07 23:21 victor.robertson.iv at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-59713-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).