https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108959

--- Comment #7 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The situation is that in func_61 we have an unused parameter which
IPA-SRA wants to remove.  It's caller constructs the unused parameter
with the following sequence (shortened):

int func_43 (int * p_44)
{
  int _1;
  _1 = *p_44_3(D);
  func_61 (_1);
}

Caller of func_43 however stores a long at that address and this is
what IPA-CP wants to pass down, while IPA-SRA knows that p_44 is used
only to create an argument for an unused formal parameter and would
like to remove both.

This means that the code in ipa-param-manipulation.cc kicks in, trying
to replace loads from the disappearing parameter with known constants
because once the parameter is gone there this can no longer be done.
But it attempts to create an invalid VIEW_CONVERT_EXPR in the process.

The simplest way of avoiding it is to disable the removal of the
parameter in these situations too extending the patch from e8109bd8776
with:

diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc
index 3de7d426b7e..e9c47c0d852 100644
--- a/gcc/ipa-sra.cc
+++ b/gcc/ipa-sra.cc
@@ -4235,6 +4235,7 @@ adjust_parameter_descriptions (cgraph_node *node,
isra_func_summary *ifs)
                          != pa->unit_size))
                    {
                      desc->split_candidate = false;
+                     desc->locally_unused = false;
                      if (dump_file && (dump_flags & TDF_DETAILS))
                        dump_dead_indices.safe_push (i);
                      break;


But since this is all code that will be eliminated anyway, perhaps we
could be aggressive here and use force_value_to_type from
tree-inline.cc?

Reply via email to