public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "matei at cs dot toronto.edu" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/18165] New: incorrect evaluation of copy constructor on return statement Date: Wed, 25 Mar 2015 19:42:00 -0000 [thread overview] Message-ID: <bug-18165-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=18165 Bug ID: 18165 Summary: incorrect evaluation of copy constructor on return statement Product: gdb Version: 7.9 Status: NEW Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: matei at cs dot toronto.edu Created attachment 8207 --> https://sourceware.org/bugzilla/attachment.cgi?id=8207&action=edit demonstrates bug GDB incorrectly executes a copy constructor at the end of a function which returns its result by value. This bug is new in 7.9, I checked 7.7.1 and 7.8.2 and they both work fine. Compile with: g++ -std=c++11 -O0 -g3 -ggdb -Wall -Wextra -pedantic a.cpp -o a I tried: gcc-4.9.2 and clang-3.5.0; same result. Run gdb as follows: gdb -q -ex 'file a' -ex 'b done' -ex 'r' -ex 'p _a' -ex 'p _a2' -ex 'p a()' -ex q With gdb-7.9, I see: $1 = {_val = 15} $2 = {_val = 15} $3 = {_val = 0} With gdb-7.8.2, I see: $1 = {_val = 15} $2 = {_val = 15} $3 = {_val = 15} Strangely enough, I noticed that commenting out the "= default" statement makes the bug disappear. But having it there is valid code, so it should work. -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2015-03-25 19:37 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-03-25 19:42 matei at cs dot toronto.edu [this message] 2015-03-25 21:36 ` [Bug gdb/18165] " matei at cs dot toronto.edu 2015-03-26 8:32 ` sivachandra at gmail dot com 2015-03-26 16:22 ` matei at cs dot toronto.edu 2015-03-26 16:48 ` matei at cs dot toronto.edu 2020-04-26 17:20 ` ssbssa at sourceware dot 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-18165-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.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: linkBe 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).