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

2017-11-19 Thread Thomas Schwinge
Hi! After r254437 "Instrument function exit with __builtin_unreachable in C++" (assuming that I bisected that correctly), I'm seeing a number of C++ "ifunc" test cases regress from PASS to UNSUPPORTED. This is because of: ifunc_available29518.c: In function 'void (* g())()':

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

2017-11-15 Thread Martin Liška
On 11/15/2017 11:04 AM, Jakub Jelinek wrote: > On Wed, Nov 15, 2017 at 10:54:23AM +0100, Martin Liška wrote: >> gcc/c/ChangeLog: >> >> 2017-11-15 Martin Liska >> >> * c-decl.c (grokdeclarator): >> Compare warn_return_type for greater than zero. >>

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

2017-11-15 Thread Jakub Jelinek
On Wed, Nov 15, 2017 at 10:54:23AM +0100, Martin Liška wrote: > gcc/c/ChangeLog: > > 2017-11-15 Martin Liska > > * c-decl.c (grokdeclarator): > Compare warn_return_type for greater than zero. > (start_function): Likewise. > (finish_function): Likewise.

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

2017-11-15 Thread Eric Botcazou
> Following patch survives regression tests and bootstraps. Please drop the Ada bits though, -Wreturn-type just doesn't work in Ada. -- Eric Botcazou

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

2017-11-15 Thread Martin Liška
On 11/15/2017 10:42 AM, Eric Botcazou wrote: >> 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.

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

2017-11-15 Thread Eric Botcazou
> 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

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

2017-11-15 Thread Jakub Jelinek
On Tue, Nov 07, 2017 at 11:08:58AM +0100, Martin Liška wrote: > > Hasn't it enabled it also for any other FEs other than C family and Fortran? > > Say jit, brig, go, lto?, ... > > I think better would be to remove the initialization to -1 and revert the > > fortran/options.c change, and instead

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

2017-11-14 Thread Martin Liška
PING^1 On 11/07/2017 11:08 AM, Martin Liška wrote: > On 11/06/2017 06:33 PM, Jakub Jelinek wrote: >> On Mon, Nov 06, 2017 at 06:23:11PM +0100, Eric Botcazou wrote: Thank you for review, done that. >>> >>> This has enabled -Wreturn-type for Ada, what we don't want since the >>> warning >>>

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

2017-11-07 Thread Martin Liška
On 11/07/2017 06:15 PM, Andreas Schwab wrote: This breaks g++.dg/torture/pr64669.C with -O3 on ia64: $ gcc/xg++ -Bgcc/ ../../gcc/gcc/testsuite/g++.dg/torture/pr64669.C -nostdinc++ -Iia64-suse-linux/libstdc++-v3/include/ia64-suse-linux -Iia64-suse-linux/libstdc++-v3/include

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

2017-11-07 Thread Andreas Schwab
This breaks g++.dg/torture/pr64669.C with -O3 on ia64: $ gcc/xg++ -Bgcc/ ../../gcc/gcc/testsuite/g++.dg/torture/pr64669.C -nostdinc++ -Iia64-suse-linux/libstdc++-v3/include/ia64-suse-linux -Iia64-suse-linux/libstdc++-v3/include -I../libstdc++-v3/libsupc++ -I../libstdc++-v3/include/backward

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

2017-11-07 Thread Martin Liška
On 11/06/2017 06:33 PM, Jakub Jelinek wrote: > On Mon, Nov 06, 2017 at 06:23:11PM +0100, Eric Botcazou wrote: >>> Thank you for review, done that. >> >> This has enabled -Wreturn-type for Ada, what we don't want since the warning >> is outsmarted by the language, so I have applied this. >> >> >>

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

2017-11-06 Thread Eric Botcazou
> Hasn't it enabled it also for any other FEs other than C family and Fortran? > Say jit, brig, go, lto?, ... Very likely, yes. > I think better would be to remove the initialization to -1 and revert the > fortran/options.c change, and instead use in the C family: > if

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

2017-11-06 Thread Martin Sebor
Sorry for being late with my comment. I just spotted this minor formatting issue. Even though GCC isn't (yet) consistent about it the keyword "constexpr" should be quoted in the error message below (and, eventually, in all diagnostic messages). Since the patch has been committed by now this is

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

2017-11-06 Thread Jakub Jelinek
On Mon, Nov 06, 2017 at 06:23:11PM +0100, Eric Botcazou wrote: > > Thank you for review, done that. > > This has enabled -Wreturn-type for Ada, what we don't want since the warning > is outsmarted by the language, so I have applied this. > > > 2017-11-06 Eric Botcazou

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

2017-11-06 Thread Eric Botcazou
> Thank you for review, done that. This has enabled -Wreturn-type for Ada, what we don't want since the warning is outsmarted by the language, so I have applied this. 2017-11-06 Eric Botcazou * gcc-interface/misc.c (gnat_post_options): Clear warn_return_type.

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

2017-11-03 Thread Martin Liška
On 10/24/2017 04:19 PM, Jason Merrill wrote: > On 10/18/2017 09:07 AM, Martin Liška wrote: >> @@ -1182,7 +1182,13 @@ cxx_eval_builtin_function_call (const constexpr_ctx >> *ctx, tree t, tree fun, >> { >>    new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t), >>

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

2017-10-24 Thread Jason Merrill
On 10/18/2017 09:07 AM, Martin Liška wrote: @@ -1182,7 +1182,13 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun, { new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t), CALL_EXPR_FN (t),

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

2017-10-18 Thread Martin Liška
On 10/18/2017 02:52 PM, Marek Polacek wrote: > On Wed, Oct 18, 2017 at 02:46:23PM +0200, Martin Liška wrote: >> On 10/12/2017 10:48 AM, Jakub Jelinek wrote: >>> On Thu, Oct 12, 2017 at 10:40:42AM +0200, Martin Liška wrote: --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -1175,7

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

2017-10-18 Thread Marek Polacek
On Wed, Oct 18, 2017 at 02:46:23PM +0200, Martin Liška wrote: > On 10/12/2017 10:48 AM, Jakub Jelinek wrote: > > On Thu, Oct 12, 2017 at 10:40:42AM +0200, Martin Liška wrote: > >> --- a/gcc/cp/constexpr.c > >> +++ b/gcc/cp/constexpr.c > >> @@ -1175,7 +1175,12 @@ cxx_eval_builtin_function_call

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

2017-10-18 Thread Martin Liška
On 10/12/2017 10:48 AM, Jakub Jelinek wrote: > On Thu, Oct 12, 2017 at 10:40:42AM +0200, Martin Liška wrote: >> --- a/gcc/cp/constexpr.c >> +++ b/gcc/cp/constexpr.c >> @@ -1175,7 +1175,12 @@ cxx_eval_builtin_function_call (const constexpr_ctx >> *ctx, tree t, tree fun, >> { >>

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

2017-10-12 Thread Jason Merrill
On Thu, Oct 12, 2017 at 4:40 AM, Martin Liška wrote: > On 10/11/2017 04:59 PM, Jason Merrill wrote: >> On Thu, Oct 5, 2017 at 12:53 PM, Martin Liška wrote: >>> On 10/05/2017 05:07 PM, Jason Merrill wrote: On Thu, Oct 5, 2017 at 6:31 AM, Martin Liška

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

2017-10-12 Thread Jakub Jelinek
On Thu, Oct 12, 2017 at 10:40:42AM +0200, Martin Liška wrote: > --- a/gcc/cp/constexpr.c > +++ b/gcc/cp/constexpr.c > @@ -1175,7 +1175,12 @@ cxx_eval_builtin_function_call (const constexpr_ctx > *ctx, tree t, tree fun, > { > new_call = build_call_array_loc (EXPR_LOCATION (t),

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

2017-10-12 Thread Martin Liška
On 10/11/2017 04:59 PM, Jason Merrill wrote: > On Thu, Oct 5, 2017 at 12:53 PM, Martin Liška wrote: >> On 10/05/2017 05:07 PM, Jason Merrill wrote: >>> On Thu, Oct 5, 2017 at 6:31 AM, Martin Liška wrote: As discussed 2 days ago on IRC with Jakub and Jonathan,

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

2017-10-11 Thread Jason Merrill
On Thu, Oct 5, 2017 at 12:53 PM, Martin Liška wrote: > On 10/05/2017 05:07 PM, Jason Merrill wrote: >> On Thu, Oct 5, 2017 at 6:31 AM, Martin Liška wrote: >>> As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says >>> that having a non-return

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

2017-10-11 Thread Martin Liška
On 10/05/2017 06:53 PM, Martin Liška wrote: >>  We probably want to provide a way to turn off this behavior. >> >> If we're going to enable this by default, we probably also want >> -Wreturn-type on by default. > > Agree. Hi. So turning on the warning by default for c++, we get about 500

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

2017-10-05 Thread Martin Liška
On 10/05/2017 05:07 PM, Jason Merrill wrote: On Thu, Oct 5, 2017 at 6:31 AM, Martin Liška wrote: As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says that having a non-return function with missing return statement is undefined behavior. We've got

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

2017-10-05 Thread Jason Merrill
On Thu, Oct 5, 2017 at 6:31 AM, Martin Liška wrote: > As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says > that having a non-return > function with missing return statement is undefined behavior. We've got > -fsanitize=return check for > that and we can in

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

2017-10-05 Thread Jakub Jelinek
On Thu, Oct 05, 2017 at 12:31:23PM +0200, Martin Liška wrote: > As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says > that having a non-return > function with missing return statement is undefined behavior. We've got > -fsanitize=return check for > that and we can in such

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

2017-10-05 Thread Martin Liška
Hello. As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says that having a non-return function with missing return statement is undefined behavior. We've got -fsanitize=return check for that and we can in such case instrument __builtin_unreachable(). This patch does that.