On Wed, Jan 20, 2016 at 9:32 AM, Eric Botcazou <ebotca...@adacore.com> wrote:
> Hi,
>
> this patch from Jan:
>   https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01388.html
> totally disabled cross-language inlining into Ada without notice, by adding a
> check that always fails when the language of the callee is not Ada...
> The attached patch simply deletes this new check to restore the initial state.
>
> Tested on x86_64-suse-linux, OK for the mainline?

I think the intent was to allow inlining a non-throwing -fnon-call-exceptions
function into a not -fnon-call-exceptions function but _not_ a
non-throwing not -fnon-call-exceptions function (that "not-throwing" is
basically a non-sensible test) into a -fnon-call-exceptions function
because that may now miss EH edges.

So the test looks conservatively correct to me - we can't reliably
check whether the callee throws if the IL now were -fnon-call-exceptions
(which we know the caller is after !opt_for_fn (callee->decl,
flag_non_call_exceptions)

So - this doesn't look correct to me.

OTOH

static inline int foo (int a, int *b)
{
  return a / *b;
}

int __attribute__((optimize("non-call-exceptions")))
bar (int *p, int *b)
{
  try
    {
      return foo (*p, b);
    }
  catch (...)
    {
      return 0;
    }
}

happily inlines foo with your patch but doesn't ICE during stmt verification.

So maybe we're not verifying that "correctness" part - ah, yeah, I think
we changed it to only verify EH tree vs. stmt consistency but not the
other way around.

Not sure if we already have a C++ testcase like the above, if not can
you add this one to the torture?

Given this I wonder if we can also change check_match to check_maybe_up,
basically handle -fnon-call-exceptions the same as -fexceptions.

Thanks,
Richard.

>
> 2016-01-20  Eric Botcazou  <ebotca...@adacore.com>
>
>         * ipa-inline.c (can_inline_edge_p): Back out overzealous check on
>         flag_non_call_exceptions compatibility.
>
>
> --
> Eric Botcazou

Reply via email to