From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 82744 invoked by alias); 25 Mar 2015 19:37:54 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 82720 invoked by uid 48); 25 Mar 2015 19:37:53 -0000 From: "matei at cs dot toronto.edu" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 7.9 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: matei at cs dot toronto.edu X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-q1/txt/msg00491.txt.bz2 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.