OSDN Git Service

* gcc.c-torture/compile/20021120-1.c: New test.
[pf3gnuchains/gcc-fork.git] / gcc / toplev.c
index a811c4b..9e57576 100644 (file)
@@ -2050,9 +2050,14 @@ check_global_declarations (vec, len)
          && (*lang_hooks.decls.warn_unused_global) (decl))
        warning_with_decl (decl, "`%s' defined but not used");
 
-      timevar_push (TV_SYMOUT);
-      (*debug_hooks->global_decl) (decl);
-      timevar_pop (TV_SYMOUT);
+      /* Avoid confusing the debug information machinery when there are
+        errors.  */
+      if (errorcount == 0 && sorrycount == 0)
+       {
+         timevar_push (TV_SYMOUT);
+         (*debug_hooks->global_decl) (decl);
+         timevar_pop (TV_SYMOUT);
+       }
     }
 }
 
@@ -2341,6 +2346,11 @@ rest_of_type_compilation (type, toplev)
      int toplev ATTRIBUTE_UNUSED;
 #endif
 {
+  /* Avoid confusing the debug information machinery when there are
+     errors.  */
+  if (errorcount != 0 || sorrycount != 0)
+    return;
+
   timevar_push (TV_SYMOUT);
 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
@@ -2419,6 +2429,9 @@ rest_of_compilation (decl)
            DECL_INITIAL (decl) = 0;
            goto exit_rest_of_compilation;
          }
+       else if (TYPE_P (parent))
+         /* A function in a local class should be treated normally.  */
+         break;
 
       /* If requested, consider whether to make this function inline.  */
       if ((DECL_INLINE (decl) && !flag_no_inline)
@@ -2998,17 +3011,24 @@ rest_of_compilation (decl)
       close_dump_file (DFI_bp, print_rtl_with_bb, insns);
       timevar_pop (TV_BRANCH_PROB);
     }
-  if (flag_if_conversion)
+  if (optimize >= 0)
     {
-      timevar_push (TV_IFCVT);
-      if (rtl_dump_file)
-       dump_flow_info (rtl_dump_file);
       open_dump_file (DFI_ce1, decl);
+      if (flag_if_conversion)
+       {
+         timevar_push (TV_IFCVT);
+         if (rtl_dump_file)
+           dump_flow_info (rtl_dump_file);
+         cleanup_cfg (CLEANUP_EXPENSIVE);
+         reg_scan (insns, max_reg_num (), 0);
+         if_convert (0);
+         timevar_pop (TV_IFCVT);
+       }
+      timevar_push (TV_JUMP);
       cleanup_cfg (CLEANUP_EXPENSIVE);
       reg_scan (insns, max_reg_num (), 0);
-      if_convert (0);
+      timevar_pop (TV_JUMP);
       close_dump_file (DFI_ce1, print_rtl_with_bb, get_insns ());
-      timevar_pop (TV_IFCVT);
     }
   if (flag_tracer)
     {
@@ -3016,47 +3036,35 @@ rest_of_compilation (decl)
       open_dump_file (DFI_tracer, decl);
       if (rtl_dump_file)
        dump_flow_info (rtl_dump_file);
-      cleanup_cfg (CLEANUP_EXPENSIVE);
       tracer ();
       cleanup_cfg (CLEANUP_EXPENSIVE);
+      reg_scan (insns, max_reg_num (), 0);
       close_dump_file (DFI_tracer, print_rtl_with_bb, get_insns ());
       timevar_pop (TV_TRACER);
-      reg_scan (get_insns (), max_reg_num (), 0);
     }
 
-  if (optimize > 0)
+  if (flag_rerun_cse_after_loop)
     {
       timevar_push (TV_CSE2);
       open_dump_file (DFI_cse2, decl);
       if (rtl_dump_file)
        dump_flow_info (rtl_dump_file);
+      /* CFG is no longer maintained up-to-date.  */
+      tem = cse_main (insns, max_reg_num (), 1, rtl_dump_file);
+      purge_all_dead_edges (0);
+      delete_trivially_dead_insns (insns, max_reg_num ());
 
-      if (flag_rerun_cse_after_loop)
+      if (tem)
        {
          timevar_push (TV_JUMP);
-         reg_scan (insns, max_reg_num (), 0);
-         timevar_pop (TV_JUMP);
-
+         rebuild_jump_labels (insns);
          cleanup_cfg (CLEANUP_EXPENSIVE);
-         /* CFG is no longer maintained up-to-date.  */
-         reg_scan (insns, max_reg_num (), 0);
-         tem = cse_main (insns, max_reg_num (), 1, rtl_dump_file);
-         purge_all_dead_edges (0);
-         delete_trivially_dead_insns (insns, max_reg_num ());
-
-         if (tem)
-           {
-             timevar_push (TV_JUMP);
-             rebuild_jump_labels (insns);
-             cleanup_cfg (CLEANUP_EXPENSIVE);
-             timevar_pop (TV_JUMP);
-           }
+         timevar_pop (TV_JUMP);
        }
-
+      reg_scan (insns, max_reg_num (), 0);
       close_dump_file (DFI_cse2, print_rtl_with_bb, insns);
-      timevar_pop (TV_CSE2);
-
       ggc_collect ();
+      timevar_pop (TV_CSE2);
     }
 
   cse_not_expected = 1;