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]

Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.


> But we don't.  Wonder if in addition to your patch or instead of it it
> wouldn't be safer (especially for FEs added in the future) to:
> 
>    /* If we see "return;" in some basic block, then we do reach the end
>       without returning a value.  */
> -  else if (warn_return_type
> +  else if (warn_return_type > 0
>             && !TREE_NO_WARNING (fun->decl)
>             && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0
>             && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fun->decl))))
> 
> in tree-cfg.c.  That change is preapproved if it works, and your
> patch if you want in addition to that is ok too.

That's the first thing I tried and it indeed works.

-- 
Eric Botcazou


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