public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56636] New: strange interaction of dynamic_cast and unique_ptr
@ 2013-03-16 16:59 gcc-bugs at naturalcleaningcalgary dot com
2013-03-16 17:40 ` [Bug c++/56636] " redi at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: gcc-bugs at naturalcleaningcalgary dot com @ 2013-03-16 16:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56636
Bug #: 56636
Summary: strange interaction of dynamic_cast and unique_ptr
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: gcc-bugs@naturalcleaningcalgary.com
The following program produces a segfault at the dynamic_cast. If I change
std::unique_ptr<int> to int*, or if I drop the dynamic_cast, the segfault goes
away.
#include <memory>
struct A
{
void F() const
{
F_impl();
}
virtual std::unique_ptr<int> F_impl() const = 0;
};
template <typename Derived>
struct A_impl : virtual A
{
std::unique_ptr<int> F_impl() const override
{
dynamic_cast<const Derived &>(*this);
return nullptr;
}
};
struct B : virtual A {};
struct C : B, A_impl<C> {};
int main()
{
C().F();
}
$ g++ -std=c++11 -otest test.cpp && ./test.exe
I am using GCC 4.7.2 under MinGW, configured with "--enable-libstdcxx-debug
--enable-languages=c,c++ --build=pentium4-pc-mingw32 --disable-nls
--disable-win32-registry --enable-threads".
(gdb) run
Starting program: c:\devel\page\build/test.exe
[New Thread 2356.0xa10]
Program received signal SIGSEGV, Segmentation fault.
__cxxabiv1::__dynamic_cast (src_ptr=0x4031f4, src_type=0x403180,
dst_type=0x403160, src2dst=4)
at ../../../../gcc-4.7.2/libstdc++-v3/libsupc++/dyncast.cc:56
56 adjust_pointer <void> (src_ptr, prefix->whole_object);
(gdb) bt
#0 __cxxabiv1::__dynamic_cast (src_ptr=0x4031f4, src_type=0x403180,
dst_type=0x403160, src2dst=4)
at ../../../../gcc-4.7.2/libstdc++-v3/libsupc++/dyncast.cc:56
#1 0x00401d04 in A_impl<C>::F_impl() const ()
#2 0x00401cc6 in A::F() const ()
#3 0x00401378 in main ()
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56636] strange interaction of dynamic_cast and unique_ptr
2013-03-16 16:59 [Bug c++/56636] New: strange interaction of dynamic_cast and unique_ptr gcc-bugs at naturalcleaningcalgary dot com
@ 2013-03-16 17:40 ` redi at gcc dot gnu.org
2013-03-20 8:38 ` daniel.kruegler at googlemail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2013-03-16 17:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56636
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |mingw
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-03-16 17:39:54 UTC ---
Must be a target issue, it works fine on x86_64-linux
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56636] strange interaction of dynamic_cast and unique_ptr
2013-03-16 16:59 [Bug c++/56636] New: strange interaction of dynamic_cast and unique_ptr gcc-bugs at naturalcleaningcalgary dot com
2013-03-16 17:40 ` [Bug c++/56636] " redi at gcc dot gnu.org
@ 2013-03-20 8:38 ` daniel.kruegler at googlemail dot com
2013-03-20 9:43 ` paolo.carlini at oracle dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-03-20 8:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56636
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler at
| |googlemail dot com
--- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-03-20 08:38:22 UTC ---
It also works for gcc 4.8.0 trunk using mingw 64.
>From gcc-bugs-return-417936-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Mar 20 08:43:12 2013
Return-Path: <gcc-bugs-return-417936-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15524 invoked by alias); 20 Mar 2013 08:43:12 -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 15491 invoked by uid 48); 20 Mar 2013 08:43:05 -0000
From: "mikpe at it dot uu.se" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/56657] [GCC 4.6/4.7] ICE - error: unrecognizable insn.
Date: Wed, 20 Mar 2013 08:43:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: mikpe at it dot uu.se
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields: CC
Message-ID: <bug-56657-4-IDSLf9A2km@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-56657-4@http.gcc.gnu.org/bugzilla/>
References: <bug-56657-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-03/txt/msg01377.txt.bz2
Content-length: 665
http://gcc.gnu.org/bugzilla/show_bug.cgi?idV657
Mikael Pettersson <mikpe at it dot uu.se> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpe at it dot uu.se
--- Comment #4 from Mikael Pettersson <mikpe at it dot uu.se> 2013-03-20 08:43:05 UTC ---
The non-preprocessed test case doesn't ICE for me with gcc-4.7.2 targeting
x86_64-w64-mingw32 (so not the same "mingw" as the reporter is using), with
either -m64 or -m32. The preprocessed test case does ICE that compiler with
-m32, but not with -m64.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56636] strange interaction of dynamic_cast and unique_ptr
2013-03-16 16:59 [Bug c++/56636] New: strange interaction of dynamic_cast and unique_ptr gcc-bugs at naturalcleaningcalgary dot com
2013-03-16 17:40 ` [Bug c++/56636] " redi at gcc dot gnu.org
2013-03-20 8:38 ` daniel.kruegler at googlemail dot com
@ 2013-03-20 9:43 ` paolo.carlini at oracle dot com
2013-03-20 10:19 ` daniel.kruegler at googlemail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-03-20 9:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56636
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-03-20 09:43:46 UTC ---
(friendly note to Daniel: "gcc 4.8.0 trunk" doesn't make much sense ;) Either
you mean trunk (future 4.9) or the recently created gcc-4_8-branch branch, from
which 4.8.0 will be released. Or maybe both, I don't know)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56636] strange interaction of dynamic_cast and unique_ptr
2013-03-16 16:59 [Bug c++/56636] New: strange interaction of dynamic_cast and unique_ptr gcc-bugs at naturalcleaningcalgary dot com
` (2 preceding siblings ...)
2013-03-20 9:43 ` paolo.carlini at oracle dot com
@ 2013-03-20 10:19 ` daniel.kruegler at googlemail dot com
2015-03-19 11:03 ` paolo.carlini at oracle dot com
2015-03-19 11:59 ` ktietz at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-03-20 10:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56636
--- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-03-20 10:19:47 UTC ---
(In reply to comment #3)
I tested gcc 4.8.0 20130310 (experimental)
>From gcc-bugs-return-417955-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Mar 20 10:23:49 2013
Return-Path: <gcc-bugs-return-417955-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 4517 invoked by alias); 20 Mar 2013 10:23:49 -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 4444 invoked by uid 48); 20 Mar 2013 10:23:44 -0000
From: "rolf.ebert.gcc at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/56644] --disable-nls requires symbols from libintl
Date: Wed, 20 Mar 2013 10:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: bootstrap
X-Bugzilla-Keywords: build
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rolf.ebert.gcc at gmx dot de
X-Bugzilla-Status: WAITING
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-56644-4-G4zsYMLNJu@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-56644-4@http.gcc.gnu.org/bugzilla/>
References: <bug-56644-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-03/txt/msg01396.txt.bz2
Content-length: 233
http://gcc.gnu.org/bugzilla/show_bug.cgi?idV644
--- Comment #4 from Rolf Ebert <rolf.ebert.gcc at gmx dot de> 2013-03-20 10:23:43 UTC ---
I used the release candidate 4.8.0 from 2013-03-16 (see initial problem
description)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56636] strange interaction of dynamic_cast and unique_ptr
2013-03-16 16:59 [Bug c++/56636] New: strange interaction of dynamic_cast and unique_ptr gcc-bugs at naturalcleaningcalgary dot com
` (3 preceding siblings ...)
2013-03-20 10:19 ` daniel.kruegler at googlemail dot com
@ 2015-03-19 11:03 ` paolo.carlini at oracle dot com
2015-03-19 11:59 ` ktietz at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-19 11:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56636
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ktietz at gcc dot gnu.org
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Maybe Kai can double check that we can close this.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56636] strange interaction of dynamic_cast and unique_ptr
2013-03-16 16:59 [Bug c++/56636] New: strange interaction of dynamic_cast and unique_ptr gcc-bugs at naturalcleaningcalgary dot com
` (4 preceding siblings ...)
2015-03-19 11:03 ` paolo.carlini at oracle dot com
@ 2015-03-19 11:59 ` ktietz at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: ktietz at gcc dot gnu.org @ 2015-03-19 11:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56636
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |WORKSFORME
--- Comment #6 from Kai Tietz <ktietz at gcc dot gnu.org> ---
So tested it for 4.8 (branch), 4.9 (branch), and 5.0 (trunk).
I can't reproduce this ICE, so I close this bug as fixed "worksforme".
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-03-19 10:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-16 16:59 [Bug c++/56636] New: strange interaction of dynamic_cast and unique_ptr gcc-bugs at naturalcleaningcalgary dot com
2013-03-16 17:40 ` [Bug c++/56636] " redi at gcc dot gnu.org
2013-03-20 8:38 ` daniel.kruegler at googlemail dot com
2013-03-20 9:43 ` paolo.carlini at oracle dot com
2013-03-20 10:19 ` daniel.kruegler at googlemail dot com
2015-03-19 11:03 ` paolo.carlini at oracle dot com
2015-03-19 11:59 ` ktietz at gcc dot gnu.org
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).