This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/18165] New: incorrect evaluation of copy constructor on return statement
- From: "matei at cs dot toronto.edu" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Wed, 25 Mar 2015 19:37:52 +0000
- Subject: [Bug gdb/18165] New: incorrect evaluation of copy constructor on return statement
- Auto-submitted: auto-generated
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.