This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: egcs, RFC: patch for possible -Wmissing-noreturn warning
- To: mj at ucw dot cz
- Subject: Re: egcs, RFC: patch for possible -Wmissing-noreturn warning
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Mon, 12 Oct 1998 12:22:43 -0400 (EDT)
- Cc: egcs-patches at cygnus dot com, egcs at cygnus dot com
> From: Martin Mares <mj@ucw.cz>
>
> Hello,
>
> > Looking at these functions, they clearly fall off their ends. Eg:
> >
> > > static inline void
> > > fde_insert (fde_accumulator *accu, fde *this_fde)
> > > {
> > > accu->linear.array[accu->linear.count++] = this_fde;
> > > }
> >
> > So why is the test flagging them? Is there another bit I need to
> > check besides:
> > current_function_returns_null && current_function_returns_value ??
>
> It is not as simple as it might look on the first sight. It's easy
> to prove there exists _no_ algorithm distinguishing functions that
> really return.
>
> [...]
>
> There are three possible cases:
>
> [1] Functions that contain no jumps. They always return and there
> is nothing to check.
> --
> Martin `MJ' Mares <mj@ucw.cz> http://atrey.karlin.mff.cuni.cz/~mj/
Yes, but IMHO, this isn't the halting problem. Its not
whether it *will* return but whether its *possible* to return. Ie,
what are the exit points of the function? Does it `return', fall off
its end or call abort/exit/longjmp/{some other `noreturn' function}?
If its only the first two, or some combination of all three,
its *possible* to return. If its only the third case, then its a
`noreturn' function.
Gcc has code to detect this stuff and its failing in the above
case which is a one line assignment statement. Clearly this static
inline function returns. So I'm convinced its either a bug or I'm not
checking all the appropriate bits.
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Icon CMT Corp.