This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR C++/19583, false warning with throw() functions


The problem here is that we warn about functions which have
throw() on them even though the functions do return.  I thought
there was an easy way to fix this would be add support to
block_may_fallthru for TRY_CATCH_EXPR and EH_FILTER_EXPR but
then I received an ICE so I decided to go a safer way in that
we should skip through them when deciding if the function
does warning about "control may reach end of non-void function".
This fixed the bug easier and we don't have to support
TRY_CATCH_EXPR and EH_FILTER_EXPR at all in block_may_fallthru.
Even though this a band-aid, the original fix to add this
warning is also a band-aid so I added a fixme so we know that
this code can be just removed once merge in the tree-profiling
branch.
This patch also fixes some of the warnings while compiling
libstdc++.

OK? Bootstrapped and tested on powerpc-darwin with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
	* tree-inline.c (expand_call_inline): Skip passed the first
	BIND_EXPR and TRY_CATCH_EXPR so that we don't warn about
	throw() functions.

Testcase:
// { dg-do compile }
// { dg-options "-O1 -W -Wall" }
static inline bool f() throw()
{
  return 0;
}
bool ff()
{
  return f(); /* { dg-bogus "control may reach" } */
}

Patch:

Attachment: temp.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]