This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Martin Liška <mliska at suse dot cz>, Jason Merrill <jason at redhat dot com>, Marek Polacek <polacek at redhat dot com>, Jonathan Wakely <jwakely at redhat dot com>
- Date: Wed, 15 Nov 2017 10:42:03 +0100
- Subject: Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
- Authentication-results: sourceware.org; auth=none
- References: <31ddd79e-1152-9dd9-663b-acd8d1bcd4ab@suse.cz> <806d7d62-1de5-128e-67e6-4b740c70d3b4@suse.cz> <20171115080726.GP14653@tucnak>
> 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