re PR middle-end/13127 (Inlining causes spurious "might be used uninitialized" warnings)
authorIan Lance Taylor <ian@airs.com>
Mon, 17 Jan 2005 17:12:27 +0000 (17:12 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Mon, 17 Jan 2005 17:12:27 +0000 (17:12 +0000)
PR middle-end/13127:
* tree-inline.c (expand_call_inline): Set TREE_NO_WARNING on
a variable set to the return value of the inlined function.

From-SVN: r93765

gcc/ChangeLog
gcc/tree-inline.c

index 06995dd0dee754bf0f64c9b7369dc4d87a201ca4..3e31b8dfa1fcae78ad68cc6888833dc6d73ab7e2 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-17  Ian Lance Taylor  <ian@airs.com>
+
+       PR middle-end/13127:
+       * tree-inline.c (expand_call_inline): Set TREE_NO_WARNING on
+       a variable set to the return value of the inlined function.
+
 2005-01-17  Mark Dettinger  <dettinge@de.ibm.com>
 
        * rtlanal.c (rtx_cost): Assign cost of 0 to a SUBREG
index b6ad39940e051aea3fa71e2d86fedfbaf347725a..a72485c2db51ec91087c989b6a6f5f7bab3328c1 100644 (file)
@@ -1580,7 +1580,18 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data)
   /* Find the lhs to which the result of this call is assigned.  */
   modify_dest = tsi_stmt (id->tsi);
   if (TREE_CODE (modify_dest) == MODIFY_EXPR)
-    modify_dest = TREE_OPERAND (modify_dest, 0);
+    {
+      modify_dest = TREE_OPERAND (modify_dest, 0);
+
+      /* The function which we are inlining might not return a value,
+        in which case we should issue a warning that the function
+        does not return a value.  In that case the optimizers will
+        see that the variable to which the value is assigned was not
+        initialized.  We do not want to issue a warning about that
+        uninitialized variable.  */
+      if (DECL_P (modify_dest))
+       TREE_NO_WARNING (modify_dest) = 1;
+    }
   else
     modify_dest = NULL;