public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors
@ 2004-03-11 14:30 lassinovsky at algorithm dot aelita dot com
2004-03-11 14:33 ` [Bug optimization/14535] " lassinovsky at algorithm dot aelita dot com
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: lassinovsky at algorithm dot aelita dot com @ 2004-03-11 14:30 UTC (permalink / raw)
To: gcc-bugs
The following conditions do cause the bug:
1. Optimized compilation (-O1,-O2, -O3)
2. Overriding virtual function is called through the base class pointer or
reference
3. Overriding virtual function calls any object method, which has exception
specification and throws an exception.
4. Overriding virtual function doesn't have an exception specification.
My configuration:
uname -a:
SunOS dog 5.8 Generic_108529-09 i86pc i386 i86pc
gcc -v
Reading specs from /opt/AESgcc/lib/gcc-lib/i386-pc-solaris2.8/3.2/specs
Configured with: /export/home/Ext/Archive/gcc-3.2/configure --
prefix=/opt/AESgcc --disable-multilib --enable-threads=posix --enable-
languages=c,c++ --with-gnu-ld --with-ld=/usr/local/bin/ld --with-gnu-as -with-
as=/usr/local/bin/as
Thread model: posix
gcc version 3.2
Test case:
======= Test case starts
#include <iostream>
class Raiser
{
public:
Raiser() throw( int )
{
throw 1;
};
};
class Object
{
public:
virtual ~Object()
{
std::cout << "~Object()" << std::endl;
};
};
class Base
{
public:
virtual ~Base(){};
virtual void Run(){};
};
class FromBase : public Base
{
public:
virtual ~FromBase(){};
virtual void Run()
{
std::cout << "Derived Run" << std::endl;
{
Object a;
std::cout << "Raise!" << std::endl;
Raiser riser;
}
std::cout << "Unreachable code" << std::endl;
};
};
int main()
{
FromBase a;
Base& b = static_cast<Base&>(a);
try
{
b.Run();
std::cout << "Unreach 2" << std::endl;
}
catch ( int )
{
std::cout << "Exception handler" << std::endl;
}
std::cout << "Exit Main" << std::endl;
return 0;
}
======= Test case end
Compilation:
gcc -O1 -o tst tst.cpp
Due to the bug the string "~Object()" will not be printed.
--
Summary: exception throwing in virtual function doesn't turn on
the local destructors
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: critical
Priority: P1
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lassinovsky at algorithm dot aelita dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug optimization/14535] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
@ 2004-03-11 14:33 ` lassinovsky at algorithm dot aelita dot com
2004-03-11 16:05 ` [Bug optimization/14535] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: lassinovsky at algorithm dot aelita dot com @ 2004-03-11 14:33 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|exception throwing in |exception throwing in
|virtual function doesn't |virtual function doesn't
|turn on the local |turn on the local
|destructors |destructors
Version|3.3.1 |3.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug optimization/14535] [3.3/3.4/3.5 Regression] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
2004-03-11 14:33 ` [Bug optimization/14535] " lassinovsky at algorithm dot aelita dot com
@ 2004-03-11 16:05 ` pinskia at gcc dot gnu dot org
2004-03-11 16:19 ` bangerth at dealii dot org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-11 16:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-11 16:05 -------
Confirmed a regression from 2.95.3, it fails with -finline so it is most likely the tree inliner.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |wrong-code
Known to fail| |3.4.0 3.3.1 3.5.0 tree-ssa
Known to work| |2.95.3
Last reconfirmed|0000-00-00 00:00:00 |2004-03-11 16:05:32
date| |
Summary|exception throwing in |[3.3/3.4/3.5 Regression]
|virtual function doesn't |exception throwing in
|turn on the local |virtual function doesn't
|destructors |turn on the local
| |destructors
Target Milestone|--- |3.3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug optimization/14535] [3.3/3.4/3.5 Regression] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
2004-03-11 14:33 ` [Bug optimization/14535] " lassinovsky at algorithm dot aelita dot com
2004-03-11 16:05 ` [Bug optimization/14535] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-03-11 16:19 ` bangerth at dealii dot org
2004-03-12 9:08 ` [Bug middle-end/14535] " rth at gcc dot gnu dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: bangerth at dealii dot org @ 2004-03-11 16:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-03-11 16:19 -------
Confirmed indeed. Here is something more selfcontained:
---------------------
extern "C" void abort();
bool destructor_called = false;
struct B {
virtual void Run(){};
};
struct D : public B {
virtual void Run()
{
struct O {
~O() { destructor_called = true; };
} o;
struct Raiser {
Raiser() throw( int ) {throw 1;};
} raiser;
};
};
int main() {
try {
D d;
static_cast<B&>(d).Run();
} catch (...) {}
if (!destructor_called)
abort ();
}
-----------------------
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ x.cc ; ./a.out
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -finline x.cc ; ./a.out
Aborted
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|3.4.0 3.3.1 3.5.0 tree-ssa |3.4.0 3.3.1 3.5.0 tree-ssa
| |3.2.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/14535] [3.3/3.4/3.5 Regression] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
` (2 preceding siblings ...)
2004-03-11 16:19 ` bangerth at dealii dot org
@ 2004-03-12 9:08 ` rth at gcc dot gnu dot org
2004-03-12 9:36 ` rth at gcc dot gnu dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-03-12 9:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2004-03-12 09:08 -------
Not the tree inliner, but something in except.c isn't doing the right thing
with the exception specification after the test passes.
--
What |Removed |Added
----------------------------------------------------------------------------
Component|optimization |middle-end
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/14535] [3.3/3.4/3.5 Regression] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
` (3 preceding siblings ...)
2004-03-12 9:08 ` [Bug middle-end/14535] " rth at gcc dot gnu dot org
@ 2004-03-12 9:36 ` rth at gcc dot gnu dot org
2004-03-12 13:44 ` lassinovsky at algorithm dot aelita dot com
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-03-12 9:36 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rth at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/14535] [3.3/3.4/3.5 Regression] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
` (4 preceding siblings ...)
2004-03-12 9:36 ` rth at gcc dot gnu dot org
@ 2004-03-12 13:44 ` lassinovsky at algorithm dot aelita dot com
2004-03-16 0:35 ` cvs-commit at gcc dot gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: lassinovsky at algorithm dot aelita dot com @ 2004-03-12 13:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lassinovsky at algorithm dot aelita dot com 2004-03-12 13:44 -------
The "magic" option -fno-enforce-eh-specs let our applications to work.
So we can live for a while :)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/14535] [3.3/3.4/3.5 Regression] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
` (5 preceding siblings ...)
2004-03-12 13:44 ` lassinovsky at algorithm dot aelita dot com
@ 2004-03-16 0:35 ` cvs-commit at gcc dot gnu dot org
2004-03-16 0:36 ` [Bug middle-end/14535] [3.3/3.4 " rth at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-16 0:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-03-16 00:35 -------
Subject: Bug 14535
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: rth@gcc.gnu.org 2004-03-16 00:35:17
Modified files:
gcc : ChangeLog except.c
Added files:
gcc/testsuite/g++.dg/eh: spec7.C
Log message:
PR middle-end/14535
* except.c (collect_one_action_chain): Record action for cleanup
outer of exception spec.
* g++.dg/eh/spec7.C: New.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3173&r2=2.3174
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/except.c.diff?cvsroot=gcc&r1=1.264&r2=1.265
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/eh/spec7.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/14535] [3.3/3.4 Regression] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
` (6 preceding siblings ...)
2004-03-16 0:35 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-16 0:36 ` rth at gcc dot gnu dot org
2004-03-16 1:29 ` mark at codesourcery dot com
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-03-16 0:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2004-03-16 00:36 -------
Patch: http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01224.html
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at codesourcery dot com
Keywords| |patch
Known to fail|3.4.0 3.3.1 3.5.0 tree-ssa |3.4.0 3.3.1 3.2.3
|3.2.3 |
Summary|[3.3/3.4/3.5 Regression] |[3.3/3.4 Regression]
|exception throwing in |exception throwing in
|virtual function doesn't |virtual function doesn't
|turn on the local |turn on the local
|destructors |destructors
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/14535] [3.3/3.4 Regression] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
` (7 preceding siblings ...)
2004-03-16 0:36 ` [Bug middle-end/14535] [3.3/3.4 " rth at gcc dot gnu dot org
@ 2004-03-16 1:29 ` mark at codesourcery dot com
2004-03-16 21:05 ` cvs-commit at gcc dot gnu dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: mark at codesourcery dot com @ 2004-03-16 1:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mark at codesourcery dot com 2004-03-16 01:29 -------
Subject: Re: [3.3/3.4 Regression] exception throwing
in virtual function doesn't turn on the local destructors
rth at gcc dot gnu dot org wrote:
> ------- Additional Comments From rth at gcc dot gnu dot org 2004-03-16 00:36 -------
> Patch: http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01224.html
>
OK for 3.4.0.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/14535] [3.3/3.4 Regression] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
` (8 preceding siblings ...)
2004-03-16 1:29 ` mark at codesourcery dot com
@ 2004-03-16 21:05 ` cvs-commit at gcc dot gnu dot org
2004-03-17 3:12 ` mmitchel at gcc dot gnu dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-16 21:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-03-16 21:05 -------
Subject: Bug 14535
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-branch
Changes by: rth@gcc.gnu.org 2004-03-16 21:05:33
Modified files:
gcc : ChangeLog except.c
Added files:
gcc/testsuite/g++.dg/eh: spec7.C
Log message:
PR middle-end/14535
* except.c (collect_one_action_chain): Create action record for
cleanup outer of exception spec.
* g++.dg/eh/spec7.C: New.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.345&r2=2.2326.2.346
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/except.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.256.2.3&r2=1.256.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/eh/spec7.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/14535] [3.3/3.4 Regression] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
` (9 preceding siblings ...)
2004-03-16 21:05 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-17 3:12 ` mmitchel at gcc dot gnu dot org
2004-03-17 18:07 ` [Bug middle-end/14535] [3.3 " cvs-commit at gcc dot gnu dot org
2004-03-17 18:21 ` [Bug middle-end/14535] " rth at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-03-17 3:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-03-17 03:11 -------
Richard, does this still fail on the 3.4 branch? I believe that you've fixed
it. If so, would you please remove 3.4 from the regression list in the summary
and from the known-to-fail list?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/14535] [3.3 Regression] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
` (10 preceding siblings ...)
2004-03-17 3:12 ` mmitchel at gcc dot gnu dot org
@ 2004-03-17 18:07 ` cvs-commit at gcc dot gnu dot org
2004-03-17 18:21 ` [Bug middle-end/14535] " rth at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-17 18:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-03-17 18:07 -------
Subject: Bug 14535
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_3-branch
Changes by: rth@gcc.gnu.org 2004-03-17 18:07:31
Modified files:
gcc : ChangeLog except.c
Log message:
PR middle-end/14535
* except.c (collect_one_action_chain): Record action for cleanup
outer of exception spec.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.943&r2=1.16114.2.944
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/except.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.233.2.6&r2=1.233.2.7
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/14535] exception throwing in virtual function doesn't turn on the local destructors
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
` (11 preceding siblings ...)
2004-03-17 18:07 ` [Bug middle-end/14535] [3.3 " cvs-commit at gcc dot gnu dot org
@ 2004-03-17 18:21 ` rth at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-03-17 18:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2004-03-17 18:21 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Known to fail|3.3.1 3.2.3 |3.2.3
Known to work|2.95.3 3.4.0 3.5.0 |2.95.3 3.4.0 3.5.0 3.3.4
Resolution| |FIXED
Summary|[3.3 Regression] exception |exception throwing in
|throwing in virtual function|virtual function doesn't
|doesn't turn on the local |turn on the local
|destructors |destructors
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2004-03-17 18:21 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-11 14:30 [Bug optimization/14535] New: exception throwing in virtual function doesn't turn on the local destructors lassinovsky at algorithm dot aelita dot com
2004-03-11 14:33 ` [Bug optimization/14535] " lassinovsky at algorithm dot aelita dot com
2004-03-11 16:05 ` [Bug optimization/14535] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-03-11 16:19 ` bangerth at dealii dot org
2004-03-12 9:08 ` [Bug middle-end/14535] " rth at gcc dot gnu dot org
2004-03-12 9:36 ` rth at gcc dot gnu dot org
2004-03-12 13:44 ` lassinovsky at algorithm dot aelita dot com
2004-03-16 0:35 ` cvs-commit at gcc dot gnu dot org
2004-03-16 0:36 ` [Bug middle-end/14535] [3.3/3.4 " rth at gcc dot gnu dot org
2004-03-16 1:29 ` mark at codesourcery dot com
2004-03-16 21:05 ` cvs-commit at gcc dot gnu dot org
2004-03-17 3:12 ` mmitchel at gcc dot gnu dot org
2004-03-17 18:07 ` [Bug middle-end/14535] [3.3 " cvs-commit at gcc dot gnu dot org
2004-03-17 18:21 ` [Bug middle-end/14535] " rth at gcc dot gnu dot 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).