------- Comment #9 from jamborm at gcc dot gnu dot org  2009-10-27 18:39 -------
Hi,

(In reply to comment #7)
> Maybe IPA SRA gets
> those two types from unrelated places?
> 

I believe they are quite elated.  The body of the function is:

<bb 2>:
  init = c_parser_initializer (0B); [return slot optimization]
  init$value_5 = init.value;
  finish_decl (0, 0, init$value_5, 0, 0);
  return;

The expected type is type of the RHS of the second statement
"init.value" while the type I get is the type of value within init.

> As I said the testcase has two incompatible variants of union tree_node and
> they are obviously not merged and thus not compatible. 

I was not sure whether you were implying that the input was invalid or
not.  If it is and we want to avoid the ICE in the simplest possible
way, we can do so with the patch below.  (Of course, we might try to
instead warn or fail in some nicer way when putting the individual
pieces from different files together.)

Index: mine/gcc/tree-sra.c
===================================================================
--- mine.orig/gcc/tree-sra.c
+++ mine/gcc/tree-sra.c
@@ -1644,7 +1644,13 @@ analyze_access_subtree (struct access *r

   if (allow_replacements && scalar && !root->first_child
       && (root->grp_hint
-         || (direct_read && root->grp_write)))
+         || (direct_read && root->grp_write))
+      /* If the user provided erroneous LTO intput, we might end up ICIng as
+        in PR 41767.  Prevent that by checking we can always find the part of
+        the aggregate that corresponds to the replacement.  */
+      && (!in_lto_p
+         || build_ref_for_offset (NULL, TREE_TYPE (root->base),
+                                  root->offset, root->type, false)))
     {
       if (dump_file && (dump_flags & TDF_DETAILS))
        {


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41767

Reply via email to