OSDN Git Service

* lib/obj-c++.exp (obj-c++_target_compile): Declare global variable,
[pf3gnuchains/gcc-fork.git] / gcc / tree-cfg.c
index 0869edc..a219d8b 100644 (file)
@@ -2110,11 +2110,11 @@ remove_bb (basic_block bb)
      loop above, so the last statement we process is the first statement
      in the block.  */
 #ifdef USE_MAPPED_LOCATION
-  if (warn_notreached && loc > BUILTINS_LOCATION)
-    warning (0, "%Hwill never be executed", &loc);
+  if (loc > BUILTINS_LOCATION)
+    warning (OPT_Wunreachable_code, "%Hwill never be executed", &loc);
 #else
-  if (warn_notreached && loc)
-    warning (0, "%Hwill never be executed", loc);
+  if (loc)
+    warning (OPT_Wunreachable_code, "%Hwill never be executed", loc);
 #endif
 
   remove_phi_nodes_and_edges_for_unreachable_block (bb);
@@ -3429,32 +3429,67 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
       break;
 
     case ADDR_EXPR:
-      /* ??? tree-ssa-alias.c may have overlooked dead PHI nodes, missing
-        dead PHIs that take the address of something.  But if the PHI
-        result is dead, the fact that it takes the address of anything
-        is irrelevant.  Because we can not tell from here if a PHI result
-        is dead, we just skip this check for PHIs altogether.  This means
-        we may be missing "valid" checks, but what can you do?
-        This was PR19217.  */
-      if (in_phi)
-       break;
+      {
+       bool old_invariant;
+       bool old_constant;
+       bool old_side_effects;
+       bool new_invariant;
+       bool new_constant;
+       bool new_side_effects;
+
+        /* ??? tree-ssa-alias.c may have overlooked dead PHI nodes, missing
+          dead PHIs that take the address of something.  But if the PHI
+          result is dead, the fact that it takes the address of anything
+          is irrelevant.  Because we can not tell from here if a PHI result
+          is dead, we just skip this check for PHIs altogether.  This means
+          we may be missing "valid" checks, but what can you do?
+          This was PR19217.  */
+        if (in_phi)
+         break;
 
-      /* Skip any references (they will be checked when we recurse down the
-        tree) and ensure that any variable used as a prefix is marked
-        addressable.  */
-      for (x = TREE_OPERAND (t, 0);
-          handled_component_p (x);
-          x = TREE_OPERAND (x, 0))
-       ;
-
-      if (TREE_CODE (x) != VAR_DECL && TREE_CODE (x) != PARM_DECL)
-       return NULL;
-      if (!TREE_ADDRESSABLE (x))
-       {
-         error ("address taken, but ADDRESSABLE bit not set");
-         return x;
-       }
-      break;
+       old_invariant = TREE_INVARIANT (t);
+       old_constant = TREE_CONSTANT (t);
+       old_side_effects = TREE_SIDE_EFFECTS (t);
+
+       recompute_tree_invarant_for_addr_expr (t);
+       new_invariant = TREE_INVARIANT (t);
+       new_side_effects = TREE_SIDE_EFFECTS (t);
+       new_constant = TREE_CONSTANT (t);
+
+       if (old_invariant != new_invariant)
+         {
+           error ("invariant not recomputed when ADDR_EXPR changed");
+           return t;
+         }
+
+        if (old_constant != new_constant)
+         {
+           error ("constant not recomputed when ADDR_EXPR changed");
+           return t;
+         }
+       if (old_side_effects != new_side_effects)
+         {
+           error ("side effects not recomputed when ADDR_EXPR changed");
+           return t;
+         }
+
+       /* Skip any references (they will be checked when we recurse down the
+          tree) and ensure that any variable used as a prefix is marked
+          addressable.  */
+       for (x = TREE_OPERAND (t, 0);
+            handled_component_p (x);
+            x = TREE_OPERAND (x, 0))
+         ;
+
+       if (TREE_CODE (x) != VAR_DECL && TREE_CODE (x) != PARM_DECL)
+         return NULL;
+       if (!TREE_ADDRESSABLE (x))
+         {
+           error ("address taken, but ADDRESSABLE bit not set");
+           return x;
+         }
+       break;
+      }
 
     case COND_EXPR:
       x = COND_EXPR_COND (t);