OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / alias.c
index 870fbc4..6bf67f3 100644 (file)
@@ -167,7 +167,7 @@ static rtx adjust_offset_for_component_ref (tree, rtx);
 static int nonoverlapping_memrefs_p (const_rtx, const_rtx);
 static int write_dependence_p (const_rtx, const_rtx, int);
 
-static void memory_modified_1 (const_rtx, const_rtx, const void *);
+static void memory_modified_1 (rtx, const_rtx, void *);
 static void record_alias_subset (alias_set_type, alias_set_type);
 
 /* Set up all info needed to perform alias analysis on memory references.  */
@@ -611,6 +611,18 @@ get_alias_set (tree t)
   if (TYPE_ALIAS_SET_KNOWN_P (t))
     return TYPE_ALIAS_SET (t);
 
+  /* We don't want to set TYPE_ALIAS_SET for incomplete types.  */
+  if (!COMPLETE_TYPE_P (t))
+    {
+      /* For arrays with unknown size the conservative answer is the
+        alias set of the element type.  */
+      if (TREE_CODE (t) == ARRAY_TYPE)
+       return get_alias_set (TREE_TYPE (t));
+
+      /* But return zero as a conservative answer for incomplete types.  */
+      return 0;
+    }
+
   /* See if the language has special handling for this type.  */
   set = lang_hooks.get_alias_set (t);
   if (set != -1)
@@ -2356,7 +2368,7 @@ init_alias_target (void)
    to be memory reference.  */
 static bool memory_modified;
 static void
-memory_modified_1 (const_rtx x, const_rtx pat ATTRIBUTE_UNUSED, const void *data)
+memory_modified_1 (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
 {
   if (MEM_P (x))
     {
@@ -2374,7 +2386,7 @@ memory_modified_in_insn_p (const_rtx mem, const_rtx insn)
   if (!INSN_P (insn))
     return false;
   memory_modified = false;
-  const_note_stores (PATTERN (insn), memory_modified_1, mem);
+  note_stores (PATTERN (insn), memory_modified_1, CONST_CAST_RTX(mem));
   return memory_modified;
 }