This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Implement -fsanitize=return (for C++ only)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Jason Merrill <jason at redhat dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 22 Nov 2013 13:17:53 +0000
- Subject: Re: [PATCH] Implement -fsanitize=return (for C++ only)
- Authentication-results: sourceware.org; auth=none
- References: <20131122092852 dot GU892 at tucnak dot redhat dot com> <20131122125947 dot GH30062 at redhat dot com>
On Fri, 22 Nov 2013, Marek Polacek wrote:
> On Fri, Nov 22, 2013 at 10:28:52AM +0100, Jakub Jelinek wrote:
> > Hi!
> > Working virtually out of Pago Pago right now.
> > In C++, falling through the end of a function that returns a value
> > without returning a value is undefined behavior (unlike C?), so this patch
> > implements instrumentation of it.
> I think we really want to have this in for C99+ as well, mainly
> because C99 removed implicit int rule.
In C it's undefined behavior only if the caller uses the return value of a
particular execution where the end of the called function was reached
(6.9.1#12 in C11, "If the } that terminates a function is reached, and the
value of the function call is used by the caller, the behavior is
Joseph S. Myers