OSDN Git Service

2008-09-03 Vladimir Makarov <vmakarov@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / tree-cfg.c
index c1344a7..ce0649d 100644 (file)
@@ -217,7 +217,10 @@ build_gimple_cfg (gimple_seq seq)
 static unsigned int
 execute_build_cfg (void)
 {
-  build_gimple_cfg (gimple_body (current_function_decl));
+  gimple_seq body = gimple_body (current_function_decl);
+
+  build_gimple_cfg (body);
+  gimple_set_body (current_function_decl, NULL);
   return 0;
 }
 
@@ -3544,17 +3547,44 @@ verify_types_in_gimple_assign (gimple stmt)
   /* Generic handling via classes.  */
   switch (TREE_CODE_CLASS (rhs_code))
     {
+    case tcc_exceptional: /* for SSA_NAME */
     case tcc_unary:
       if (!useless_type_conversion_p (lhs_type, rhs1_type))
        {
          error ("non-trivial conversion at assignment");
-         debug_generic_expr (lhs);
-         debug_generic_expr (rhs1);
+         debug_generic_expr (lhs_type);
+         debug_generic_expr (rhs1_type);
+         return true;
+       }
+      break;
+
+    case tcc_binary:
+      if (!is_gimple_val (rhs1) || !is_gimple_val (rhs2))
+       {
+         error ("invalid operands in binary expression");
+         return true;
+       }
+      if (!useless_type_conversion_p (lhs_type, rhs1_type)
+         || !useless_type_conversion_p (lhs_type, rhs2_type))
+       {
+         error ("type mismatch in binary expression");
+         debug_generic_stmt (lhs_type);
+         debug_generic_stmt (rhs1_type);
+         debug_generic_stmt (rhs2_type);
          return true;
        }
       break;
 
     case tcc_reference:
+      /* All tcc_reference trees are GIMPLE_SINGLE_RHS.  Verify that
+         no implicit type change happens here.  */
+      if (!useless_type_conversion_p (lhs_type, rhs1_type))
+       {
+         error ("non-trivial conversion at assignment");
+         debug_generic_expr (lhs_type);
+         debug_generic_expr (rhs1_type);
+         return true;
+       }
       return verify_types_in_gimple_reference (rhs1);
 
     case tcc_comparison:
@@ -3832,7 +3862,7 @@ verify_stmt (gimple_stmt_iterator *gsi)
   if (addr)
     {
       debug_generic_expr (addr);
-      inform ("in statement");
+      inform (input_location, "in statement");
       debug_gimple_stmt (stmt);
       return true;
     }
@@ -5871,7 +5901,7 @@ dump_function_to_file (tree fn, FILE *file, int flags)
   if (dsf && (flags & TDF_DETAILS))
     dump_eh_tree (file, dsf);
 
-  if (flags & TDF_RAW && !gimple_body (fn))
+  if (flags & TDF_RAW && !gimple_has_body_p (fn))
     {
       dump_node (fn, TDF_SLIM | flags, file);
       return;
@@ -6113,7 +6143,7 @@ print_loops (FILE *file, int verbosity)
 {
   basic_block bb;
 
-  bb = BASIC_BLOCK (NUM_FIXED_BLOCKS);
+  bb = ENTRY_BLOCK_PTR;
   if (bb && bb->loop_father)
     print_loop_and_siblings (file, bb->loop_father, 0, verbosity);
 }
@@ -6533,7 +6563,13 @@ gimple_purge_all_dead_eh_edges (const_bitmap blocks)
 
   EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i, bi)
     {
-      changed |= gimple_purge_dead_eh_edges (BASIC_BLOCK (i));
+      basic_block bb = BASIC_BLOCK (i);
+
+      /* Earlier gimple_purge_dead_eh_edges could have removed
+        this basic block already.  */
+      gcc_assert (bb || changed);
+      if (bb != NULL)
+       changed |= gimple_purge_dead_eh_edges (bb);
     }
 
   return changed;