On Wed, Aug 31, 2016 at 8:46 PM, Eric Botcazou <ebotca...@adacore.com> wrote:
> Hi,
>
> the attached Ada testcase triggers a segfault in param_change_prob because the
> parameter is VIEW_CONVERT_EXPR<INTEGER_CST> (or <SSA_NAME) for a variant) so
> it fools the logic and walk_aliased_vdefs is called on a NULL second argument
> as the call is to a pure function.  The proposed fix is just to strip the VCE.
>
> Tested on x86_64-suse-linux, OK for the mainline?

I think the fix is not enough if op is for example MEM[&"foo"] (no
V_C_E) then get_base_address
returns a STRING_CST and you run into exactly the same issue.

So I think it's better to apply get_base_address here rather than only
stripping VIEW_CONVERT_EXRPs.
(beware of it returning NULL_TREE for WITH_SIZE_EXPRs, thus maybe
strip those first as well)

You could after all have COMPONENT_REF<VIEW_CONVERT_EXPR
<INTEGER_CST>> as well ...

Richard.

>
> 2016-08-31  Eric Botcazou  <ebotca...@adacore.com>
>
>         * ipa-inline-analysis.c (param_change_prob): Strip VIEW_CONVERT_EXPR.
>
>
> 2016-08-31  Eric Botcazou  <ebotca...@adacore.com>
>
>         * gnat.dg/opt58.adb: New test.
>         * gnat.dg/opt58_pkg.ads: New helper.
>
> --
> Eric Botcazou

Reply via email to