OSDN Git Service

PR c++/24686
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa.c
index fc1754f..081d21a 100644 (file)
@@ -803,6 +803,7 @@ init_tree_ssa (void)
                                     int_tree_map_eq, NULL);
   call_clobbered_vars = BITMAP_ALLOC (NULL);
   addressable_vars = BITMAP_ALLOC (NULL);
+  init_alias_heapvars ();
   init_ssanames ();
   init_phinodes ();
   global_var = NULL_TREE;
@@ -867,6 +868,7 @@ delete_tree_ssa (void)
   addressable_vars = NULL;
   modified_noreturn_calls = NULL;
   aliases_computed_p = false;
+  delete_alias_heapvars ();
   gcc_assert (!need_ssa_update_p ());
 }
 
@@ -903,6 +905,15 @@ tree_ssa_useless_type_conversion_1 (tree outer_type, tree inner_type)
           && TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE)
     return true;
 
+  /* Don't lose casts between pointers to volatile and non-volatile
+     qualified types.  Doing so would result in changing the semantics
+     of later accesses.  */
+  else if (POINTER_TYPE_P (inner_type)
+           && POINTER_TYPE_P (outer_type)
+          && TYPE_VOLATILE (TREE_TYPE (outer_type))
+             != TYPE_VOLATILE (TREE_TYPE (inner_type)))
+    return false;
+
   /* Pointers/references are equivalent if their pointed to types
      are effectively the same.  This allows to strip conversions between
      pointer types with different type qualifiers.  */