* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
@ 2014-03-02 15:14 ` rob.desbois at gmail dot com
2014-03-02 22:24 ` rob.desbois at gmail dot com
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rob.desbois at gmail dot com @ 2014-03-02 15:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
--- Comment #1 from rob.desbois at gmail dot com ---
...having realised that this might look like I just don't grok move
construction I expanded my test - adding copy & move constructors & assignment
operators to foo and re-running the test still gives the same result, i.e. the
address of the function argument is not the address of a constructed object:
constructed foo @ 0x7fff80e0f25f
default argument is at 0x7fff80e0f240
(I can attach the enhanced test on request)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
2014-03-02 15:14 ` [Bug c++/60367] " rob.desbois at gmail dot com
@ 2014-03-02 22:24 ` rob.desbois at gmail dot com
2014-03-03 10:32 ` rob.desbois at gmail dot com
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rob.desbois at gmail dot com @ 2014-03-02 22:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
--- Comment #3 from rob.desbois at gmail dot com ---
Adding a destructor didn't fix it for me - though it was destroyed for the same
address as the constructed object.
constructed foo @ 0x7fffa012e5ef
default argument is at 0x7fffa012e5d0
destructed foo @ 0x7fffa012e5ef
For what it's worth I tried putting a size_t member into the object being
constructed, and using a member-initializer to set it to an identifiable bit
pattern - even though the temporary was at an 'unconstructed' address, the
size_t was repeatedly correct. The gremlins are messing with my head...
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
2014-03-02 15:14 ` [Bug c++/60367] " rob.desbois at gmail dot com
2014-03-02 22:24 ` rob.desbois at gmail dot com
@ 2014-03-03 10:32 ` rob.desbois at gmail dot com
2014-03-03 11:20 ` rob.desbois at gmail dot com
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rob.desbois at gmail dot com @ 2014-03-03 10:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
--- Comment #4 from rob.desbois at gmail dot com ---
The problem only seems to occur when using the pattern "= {}" to default the
parameter; "= foo{}" and "= foo()" don't seem to provoke the differing
addresses.
I have confirmed that member data set in the default constructor seems to be
correct in the temporary despite it being at an 'unconstructed' address. The
address of the 'unconstructed' temporary is consistently the size of the
nearest whole word to sizeof(foo) below the actually-constructed address, so it
seems the address isn't just random but possibly correct in itself.
It seems that the copy/move constructor has been replaced by a memcpy(), thus
losing the side-effects. I didn't state earlier but should confirm: this occurs
with "-O0" turning off optimizations.
Behaviour with clang (3.3 final) is as expected.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
` (2 preceding siblings ...)
2014-03-03 10:32 ` rob.desbois at gmail dot com
@ 2014-03-03 11:20 ` rob.desbois at gmail dot com
2014-03-04 11:20 ` redi at gcc dot gnu.org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rob.desbois at gmail dot com @ 2014-03-03 11:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
--- Comment #5 from rob.desbois at gmail dot com ---
The following is a side-by-side diff of the disassembly of the incorrect
version vs. a correct version (defaulting the parameter with = foo{}). The
object foo has a single member of type char initialized in default, move, and
copy ctors.
incorrect version | correct version
-------------------------------------------|-----------------------------------
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
push %rbx push %rbx
sub $0x28,%rsp | sub $0x18,%rsp
lea -0x11(%rbp),%rax lea -0x11(%rbp),%rax
mov %rax,%rdi mov %rax,%rdi
callq 0x400bbe <_ZN3fooC2Ev> | callq 0x400bb8 <_ZN3fooC2Ev>
movzbl -0x11(%rbp),%eax | lea -0x11(%rbp),%rax
mov %al,-0x30(%rbp) <
lea -0x30(%rbp),%rax <
mov %rax,%rdi mov %rax,%rdi
callq 0x4009f0 <_Z6test_a3foo> | callq 0x400a50 <_Z6test_b3foo>
lea -0x11(%rbp),%rax lea -0x11(%rbp),%rax
mov %rax,%rdi mov %rax,%rdi
callq 0x400bfe <_ZN3fooD2Ev> | callq 0x400bf8 <_ZN3fooD2Ev>
mov $0x0,%eax mov $0x0,%eax
jmp 0x400b65 <main+85> | jmp 0x400b5e <main+78>
mov %rax,%rbx mov %rax,%rbx
lea -0x11(%rbp),%rax lea -0x11(%rbp),%rax
mov %rax,%rdi mov %rax,%rdi
callq 0x400bfe <_ZN3fooD2Ev> | callq 0x400bf8 <_ZN3fooD2Ev>
mov %rbx,%rax mov %rbx,%rax
mov %rax,%rdi mov %rax,%rdi
callq 0x4008b0 <_Unwind_Resume@plt> callq 0x4008b0
<_Unwind_Resume@plt>
add $0x28,%rsp | add $0x18,%rsp
pop %rbx pop %rbx
pop %rbp pop %rbp
retq retq
It does look like the incorrect version on the left could be bitwise-copying
the default-constructed object.
As an aside - both versions have a single constructor call but TWO destructor
calls...
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
` (3 preceding siblings ...)
2014-03-03 11:20 ` rob.desbois at gmail dot com
@ 2014-03-04 11:20 ` redi at gcc dot gnu.org
2014-03-04 11:20 ` redi at gcc dot gnu.org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-04 11:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |victor.robertson.iv at gmail dot c
| |om
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 59713 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
` (4 preceding siblings ...)
2014-03-04 11:20 ` redi at gcc dot gnu.org
@ 2014-03-04 11:20 ` redi at gcc dot gnu.org
2014-03-10 19:23 ` jason at gcc dot gnu.org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-04 11:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-03-04
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
` (5 preceding siblings ...)
2014-03-04 11:20 ` redi at gcc dot gnu.org
@ 2014-03-10 19:23 ` jason at gcc dot gnu.org
2014-03-11 21:08 ` reichelt at gcc dot gnu.org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2014-03-10 19:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
` (6 preceding siblings ...)
2014-03-10 19:23 ` jason at gcc dot gnu.org
@ 2014-03-11 21:08 ` reichelt at gcc dot gnu.org
2014-05-13 16:05 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-03-11 21:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
Volker Reichelt <reichelt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu.org
--- Comment #9 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
*** Bug 58501 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
` (7 preceding siblings ...)
2014-03-11 21:08 ` reichelt at gcc dot gnu.org
@ 2014-05-13 16:05 ` jason at gcc dot gnu.org
2014-05-13 16:06 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2014-05-13 16:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue May 13 16:05:01 2014
New Revision: 210381
URL: http://gcc.gnu.org/viewcvs?rev=210381&root=gcc&view=rev
Log:
PR c++/60367
* call.c (convert_default_arg): Remove special handling for
CONSTRUCTOR.
Added:
branches/gcc-4_8-branch/gcc/testsuite/g++.dg/overload/defarg8.C
Modified:
branches/gcc-4_8-branch/gcc/cp/ChangeLog
branches/gcc-4_8-branch/gcc/cp/call.c
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
` (8 preceding siblings ...)
2014-05-13 16:05 ` jason at gcc dot gnu.org
@ 2014-05-13 16:06 ` jason at gcc dot gnu.org
2014-07-08 17:33 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2014-05-13 16:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |4.8.3
--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.8.3/4.9.0.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
` (9 preceding siblings ...)
2014-05-13 16:06 ` jason at gcc dot gnu.org
@ 2014-07-08 17:33 ` redi at gcc dot gnu.org
2015-03-03 18:13 ` vhaisman at gmail dot com
2015-03-03 18:15 ` redi at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2014-07-08 17:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |personal@e-maxx.ru
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 61751 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
` (10 preceding siblings ...)
2014-07-08 17:33 ` redi at gcc dot gnu.org
@ 2015-03-03 18:13 ` vhaisman at gmail dot com
2015-03-03 18:15 ` redi at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: vhaisman at gmail dot com @ 2015-03-03 18:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
Václav Zeman <vhaisman at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vhaisman at gmail dot com
--- Comment #13 from Václav Zeman <vhaisman at gmail dot com> ---
This bug appears to be affecting 4.7.x series as well. Is there a chance to get
this fixed for 4.7 as well?
http://stackoverflow.com/questions/28837142/stdmap-argument-with-default-empty-map-segfaults-in-gcc
>From gcc-bugs-return-479223-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 03 18:14:58 2015
Return-Path: <gcc-bugs-return-479223-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 46178 invoked by alias); 3 Mar 2015 18:14:57 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 46063 invoked by uid 55); 3 Mar 2015 18:14:54 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/64883] FAIL: 17_intro/headers/c++*/all_attributes.cc (test for excess errors) on x86_64-apple-darwin14
Date: Tue, 03 Mar 2015 18:14:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: redi at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64883-4-yWyezhlfPF@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64883-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64883-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-03/txt/msg00367.txt.bz2
Content-length: 862
https://gcc.gnu.org/bugzilla/show_bug.cgi?idd883
--- Comment #29 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue Mar 3 18:14:20 2015
New Revision: 221160
URL: https://gcc.gnu.org/viewcvs?rev"1160&root=gcc&view=rev
Log:
2015-03-03 Iain Sandoe <iain@codesourcery.com>
PR libstdc++/64883
* testsuite/17_intro/headers/c++1998/all_attributes.cc: Don't check
visibility for Darwin.
* testsuite/17_intro/headers/c++200x/all_attributes.cc: Likewise, and
also deprecated.
* testsuite/17_intro/headers/c++2014/all_attributes.cc: Likewise.
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
trunk/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_attributes.cc
trunk/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/60367] Default argument object is not getting constructed
2014-02-28 17:30 [Bug c++/60367] New: Default argument object is not getting constructed rob.desbois at gmail dot com
` (11 preceding siblings ...)
2015-03-03 18:13 ` vhaisman at gmail dot com
@ 2015-03-03 18:15 ` redi at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-03 18:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60367
--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Václav Zeman from comment #13)
> This bug appears to be affecting 4.7.x series as well. Is there a chance to
> get this fixed for 4.7 as well?
No, the 4.7 branch is closed and there will be no more 4.7.x releases.
>From gcc-bugs-return-479226-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 03 18:16:39 2015
Return-Path: <gcc-bugs-return-479226-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 48891 invoked by alias); 3 Mar 2015 18:16:38 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 48762 invoked by uid 48); 3 Mar 2015 18:16:32 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/64883] FAIL: 17_intro/headers/c++*/all_attributes.cc (test for excess errors) on x86_64-apple-darwin14
Date: Tue, 03 Mar 2015 18:16:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status assigned_to target_milestone
Message-ID: <bug-64883-4-hMGqnjA1dM@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64883-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64883-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-03/txt/msg00370.txt.bz2
Content-length: 568
https://gcc.gnu.org/bugzilla/show_bug.cgi?idd883
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
Assignee|redi at gcc dot gnu.org |unassigned at gcc dot gnu.org
Target Milestone|5.0 |---
--- Comment #30 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I've committed Iain's patch, any further changes can wait for stage 1.
^ permalink raw reply [flat|nested] 14+ messages in thread