re PR tree-optimization/14107 (Return warnings don't work without optimizations enabled)
authorPaolo Bonzini <bonzini@gnu.org>
Mon, 12 Jul 2004 06:56:45 +0000 (06:56 +0000)
committerPaolo Bonzini <bonzini@gcc.gnu.org>
Mon, 12 Jul 2004 06:56:45 +0000 (06:56 +0000)
gcc/ChangeLog:
2004-06-29  Paolo Bonzini  <bonzini@gnu.org>

PR tree-optimization/14107
* gimplify.c (gimplify_return_expr): Accept a
RETURN_EXPR with an error argument.
* tree-optimize.c (init_tree_optimization_passes):
Run pass_warn_function_return at -O0.

gcc/cp/ChangeLog:
2004-06-29  Paolo Bonzini  <bonzini@gnu.org>

PR tree-optimization/14107
* decl.c (finish_function): Remove temporary band-aid.

From-SVN: r84550

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/gimplify.c
gcc/tree-optimize.c

index 839341720b6b078a793d32f7f9c97f174a76a164..1cac842bde386ef588cbdebf9e071b1f4d005b8b 100644 (file)
@@ -1,3 +1,11 @@
+2004-07-12  Paolo Bonzini  <bonzini@gnu.org>
+
+       PR tree-optimization/14107
+       * gimplify.c (gimplify_return_expr): Accept a
+       RETURN_EXPR with an error argument.
+       * tree-optimize.c (init_tree_optimization_passes):
+       Run pass_warn_function_return at -O0.
+
 2004-07-12  Roger Sayle  <roger@eyesopen.com>
 
        * doc/invoke.texi: Correct -fasynchronous-unwind-tables option
index e8cef5fa1cbdae85c2ecce191daf2a148095cba7..099b1bbb87bc78dce7e893ef2793651543956dd5 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-12  Paolo Bonzini  <bonzini@gnu.org>
+
+       PR tree-optimization/14107
+       * decl.c (finish_function): Remove temporary band-aid.
+
 2004-07-11  Mark Mitchell  <mark@codesourcery.com>
 
        * call.c (build_operator_new_call): Avoid using push_to_top_level.
index 6f701ca93561a1c15863f7ab89be9d6aad2bea88..ab5dd84531a224ba32fa3746a482b3bb9839d9bd 100644 (file)
@@ -10348,13 +10348,10 @@ finish_function (int flags)
       && !current_function_returns_value && !current_function_returns_null
       /* Don't complain if we abort or throw.  */
       && !current_function_returns_abnormally
-      && !DECL_NAME (DECL_RESULT (fndecl)))
-#if 0
-    /* Enable this for all functions until bug 14107 is fixed properly.  */
+      && !DECL_NAME (DECL_RESULT (fndecl))
       /* Normally, with -Wreturn-type, flow will complain.  Unless we're an
         inline function, as we might never be compiled separately.  */
       && (DECL_INLINE (fndecl) || processing_template_decl))
-#endif
     warning ("no return statement in function returning non-void");
 
   /* Store the end of the function, so that we get good line number
index 5b8762067694fc3cf924caf14640dccbfb283399..f2003b65628ef562bc6f5864cc74341e338a1d8e 100644 (file)
@@ -928,12 +928,10 @@ gimplify_return_expr (tree stmt, tree *pre_p)
   tree ret_expr = TREE_OPERAND (stmt, 0);
   tree result_decl, result;
 
-  if (!ret_expr || TREE_CODE (ret_expr) == RESULT_DECL)
+  if (!ret_expr || TREE_CODE (ret_expr) == RESULT_DECL
+      || ret_expr == error_mark_node)
     return GS_ALL_DONE;
 
-  if (ret_expr == error_mark_node)
-    return GS_ERROR;
-
   if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl))))
     result_decl = NULL_TREE;
   else
index 94681c4c0448002794a9ac29c50d3ba5523398b3..e8c951bbab703913323d87649e27906a2452c1f5 100644 (file)
@@ -273,6 +273,7 @@ init_tree_optimization_passes (void)
   NEXT_PASS (pass_tree_profile);
   NEXT_PASS (pass_init_datastructures);
   NEXT_PASS (pass_all_optimizations);
+  NEXT_PASS (pass_warn_function_return);
   NEXT_PASS (pass_mudflap_2);
   NEXT_PASS (pass_free_datastructures);
   NEXT_PASS (pass_expand);
@@ -319,7 +320,6 @@ init_tree_optimization_passes (void)
   NEXT_PASS (DUP_PASS (pass_phiopt));
   NEXT_PASS (pass_tail_calls);
   NEXT_PASS (pass_late_warn_uninitialized);
-  NEXT_PASS (pass_warn_function_return);
   NEXT_PASS (pass_del_pta);
   NEXT_PASS (pass_del_ssa);
   NEXT_PASS (pass_nrv);