public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64501] New: Unreachable catch BB for try blocks that cannot create an exception of specific type
@ 2015-01-05 16:18 marxin at gcc dot gnu.org
2015-01-05 16:45 ` [Bug c++/64501] " glisse at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: marxin at gcc dot gnu.org @ 2015-01-05 16:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64501
Bug ID: 64501
Summary: Unreachable catch BB for try blocks that cannot create
an exception of specific type
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: hubicka at gcc dot gnu.org
Hello.
I've been wondering if following catch branch in main can be optimized out as
unreachable:
void linker_error (void);
void t()
{
try
{
throw (char)(1);
}
catch (char t) {}
}
int
main()
{
try
{
t();
}
catch (void *v)
{
linker_error ();
}
}
As there's no possible emission of an exception of void*, can by call of
linker_error removed?
Thanks,
Martin
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/64501] Unreachable catch BB for try blocks that cannot create an exception of specific type
2015-01-05 16:18 [Bug c++/64501] New: Unreachable catch BB for try blocks that cannot create an exception of specific type marxin at gcc dot gnu.org
@ 2015-01-05 16:45 ` glisse at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: glisse at gcc dot gnu.org @ 2015-01-05 16:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64501
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
There are a lot of possible optimizations related to exceptions, and most
compilers perform almost none :-(
The compiler could notice that t is nothrow, but it doesn't. If you mark it
explicitly (add throw() for instance) main will be simplified. PR 53294 would
also let it simplify for different reasons.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-05 16:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-05 16:18 [Bug c++/64501] New: Unreachable catch BB for try blocks that cannot create an exception of specific type marxin at gcc dot gnu.org
2015-01-05 16:45 ` [Bug c++/64501] " glisse 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).