This is the mail archive of the
mailing list for the GCC project.
Re: PR c++/36254 wrong "control reaches end of non-void function" warning
2008/10/27 Jakub Jelinek <email@example.com>:
> On Mon, Oct 27, 2008 at 11:11:17AM +0100, Manuel López-Ibáñez wrote:
>> 2008/10/26 Mark Mitchell <firstname.lastname@example.org>:
>> > Manuel López-Ibáñez wrote:
>> >> 2008-10-23 Manuel López-Ibáñez <email@example.com>
>> >> PR c++/36254
>> >> * gimplify.c (gimplify_expr): Propagate the no_warning flag.
>> >> * gimple-low.c (lower_function_body): Propagate the no_warning
>> >> flag.
>> > What does the comipler-generated code for this testcase look like, and
>> > why is it confusing the warning machinery?
>> See the gimple dump attached. Basically, we surround the whole
>> function in try/finally. Then, because flow falls to the end of the
>> function, we add a return.
>> I can attach other dumps if you want, but I think the problem is already here.
> The problem is different and you really don't want to play with nowarning
> flag. gimple_seq_may_fallthru handles try/finally and try/catch correctly.
> The problem is the unnecessary GIMPLE_GOTO after GIMPLE_RETURN which makes
> gimple_seq_may_fallthru believe this can fallthru, even if it can't.
> I'll have a look.
According to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36254#c10
this cannot be fixed without enabling more optimizations at -O0. So I
hope my patch is reconsidered. AFAIK, this is compiler generated code,
so we should not warn. It doesn't matter if the generated code is dead
and could be removed. What is the problem with setting nowarning flag?