This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/65002] [5 Regression] ICE: Segmentation fault


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

--- Comment #6 from Ilya Enkovich <enkovich.gnu at gmail dot com> ---
Is this actually an ICE on valid code?  'const' attribute seems incorrect here
similar to what we had in PR64353.

The problem comes from SSA inconsistency caused by the wrong attribute. 
Probably just ignore such cases in SRA as was previously proposed for PR64353?

Here is a possible patch (SSA update at fixup_cfg start may be removed then):

diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index ad9584e..7f78e68 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -4890,6 +4890,20 @@ some_callers_have_mismatched_arguments_p (struct
cgraph_node *node,
   return false;
 }

+/* Return false if all callers have vuse attached to a call statement.  */
+
+static bool
+some_callers_have_no_vuse_p (struct cgraph_node *node,
+                            void *data ATTRIBUTE_UNUSED)
+{
+  struct cgraph_edge *cs;
+  for (cs = node->callers; cs; cs = cs->next_caller)
+    if (!cs->call_stmt || !gimple_vuse (cs->call_stmt))
+      return true;
+
+  return false;
+}
+
 /* Convert all callers of NODE.  */

 static bool
@@ -5116,6 +5130,15 @@ ipa_early_sra (void)
       goto simple_out;
     }

+  if (node->call_for_symbol_thunks_and_aliases
+       (some_callers_have_no_vuse_p, NULL, true))
+    {
+      if (dump_file)
+       fprintf (dump_file, "There are callers with no VUSE attached "
+                "to a call stmt.\n");
+      goto simple_out;
+    }
+
   bb_dereferences = XCNEWVEC (HOST_WIDE_INT,
                                 func_param_count
                                 * last_basic_block_for_fn (cfun));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]