From 81bafd3637c9563715680b98fae7009ff7809a6f Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 17 Jan 2005 17:12:27 +0000 Subject: [PATCH] re PR middle-end/13127 (Inlining causes spurious "might be used uninitialized" warnings) 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 | 6 ++++++ gcc/tree-inline.c | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 06995dd0dee7..3e31b8dfa1fc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-01-17 Ian Lance Taylor + + 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 * rtlanal.c (rtx_cost): Assign cost of 0 to a SUBREG diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index b6ad39940e05..a72485c2db51 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -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; -- 2.47.2