public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59246] GCC should issue runtime error for calling pure virtual function with definition
[not found] <bug-59246-4@http.gcc.gnu.org/bugzilla/>
@ 2013-11-22 7:07 ` boostcpp at gmail dot com
2013-11-22 11:26 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: boostcpp at gmail dot com @ 2013-11-22 7:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59246
--- Comment #1 from Ryou Ezoe <boostcpp at gmail dot com> ---
According to the de facto standard C++ ABI:
http://mentorembedded.github.io/cxx-abi/abi.html#pure-virtual
__cxa_pure_virtual will be called:
> if the user calls a non-overridden pure virtual function, which has undefined
> behavior according to the C++ Standard.
When this abstract class Base's destructor was called,
class objects derived from Base are already destructed.
So it is non-overridden and it is also undefined behavior.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/59246] GCC should issue runtime error for calling pure virtual function with definition
[not found] <bug-59246-4@http.gcc.gnu.org/bugzilla/>
2013-11-22 7:07 ` [Bug c++/59246] GCC should issue runtime error for calling pure virtual function with definition boostcpp at gmail dot com
@ 2013-11-22 11:26 ` redi at gcc dot gnu.org
2013-11-24 0:45 ` boostcpp at gmail dot com
2021-11-10 9:48 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2013-11-22 11:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59246
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-11-22
Ever confirmed|0 |1
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Ryou Ezoe from comment #0)
> // call by unqualified name is virtual function call.
> // virtual function call during destruction is undefined.
N.B. it's only undefined if the function is a pure virtual, not in general, and
you do get a warning:
pv.cc: In destructor ‘virtual Base::~Base()’:
pv.cc:14:7: warning: pure virtual ‘virtual void Base::f()’ called from
destructor [enabled by default]
f() ;
^
Here's a complete testcase (you can't get a runtime error if your program can't
be run!)
struct Base
{
virtual void f() = 0 ;
virtual ~Base() ;
} ;
// pure virtual function with definition
void Base::f() { }
Base::~Base()
{
// call by unqualified name is virtual function call.
// virtual function call during destruction is undefined.
f() ;
}
struct Derived : Base
{
void f() { }
};
int main()
{
Derived d;
}
>From gcc-bugs-return-435520-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Nov 22 11:26:58 2013
Return-Path: <gcc-bugs-return-435520-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 26397 invoked by alias); 22 Nov 2013 11:26:58 -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 26238 invoked by uid 48); 22 Nov 2013 11:26:55 -0000
From: "paulo@matos-sorge.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/57748] [4.7/4.8/4.9 Regression] ICE when expanding assignment to unaligned zero-sized array
Date: Fri, 22 Nov 2013 11:26: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-Version: 4.8.0
X-Bugzilla-Keywords: ice-on-valid-code, wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paulo@matos-sorge.com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.3
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57748-4-FaIzWMfyS8@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57748-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57748-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: 2013-11/txt/msg02297.txt.bz2
Content-length: 472
http://gcc.gnu.org/bugzilla/show_bug.cgi?idW748
--- Comment #48 from Paulo J. Matos <paulo@matos-sorge.com> ---
(In reply to Paulo J. Matos from comment #47)
> Would like to add that I backported the patch locally and all the testsuite
> is passing until now. The ICE I initially got is not gone as well. So I can
> confirm that as far as I know, the patch is indeed fine in 4.8.
s/not/now/.
Obviously I meant that the patch applies cleanly and works for me in 4.8.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/59246] GCC should issue runtime error for calling pure virtual function with definition
[not found] <bug-59246-4@http.gcc.gnu.org/bugzilla/>
2013-11-22 7:07 ` [Bug c++/59246] GCC should issue runtime error for calling pure virtual function with definition boostcpp at gmail dot com
2013-11-22 11:26 ` redi at gcc dot gnu.org
@ 2013-11-24 0:45 ` boostcpp at gmail dot com
2021-11-10 9:48 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: boostcpp at gmail dot com @ 2013-11-24 0:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59246
--- Comment #3 from Ryou Ezoe <boostcpp at gmail dot com> ---
Sorry.
I should have provide a complete source code.
I thought it's more helpful to issue runtime abort even though the standard
doesn't requires it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/59246] GCC should issue runtime error for calling pure virtual function with definition
[not found] <bug-59246-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2013-11-24 0:45 ` boostcpp at gmail dot com
@ 2021-11-10 9:48 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-10 9:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59246
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Last reconfirmed|2013-11-22 00:00:00 |2021-11-10
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-10 9:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-59246-4@http.gcc.gnu.org/bugzilla/>
2013-11-22 7:07 ` [Bug c++/59246] GCC should issue runtime error for calling pure virtual function with definition boostcpp at gmail dot com
2013-11-22 11:26 ` redi at gcc dot gnu.org
2013-11-24 0:45 ` boostcpp at gmail dot com
2021-11-10 9:48 ` pinskia 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).