This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][fortran] PR 63701 Make sure variable is always used initialised
- From: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, fortran at gcc dot gnu dot org
- Date: Tue, 11 Nov 2014 10:53:45 +0000
- Subject: [PATCH][fortran] PR 63701 Make sure variable is always used initialised
- Authentication-results: sourceware.org; auth=none
Hi all,
As this trivial PR says, found is not initialised, later conditionally
set to true in the for loop that follows and gcc_asserted in the end.
It is expected that the found = true; statement will always be hit, but
in case something elsewhere goes wrong and it is not, we want the
gcc_assert to
use a properly initialised found = false value.
Ok for trunk?
Thanks,
Kyrill
2014-11-11 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR fortran/63701
* trans-expr.c (gfc_get_tree_for_caf_expr): Initialise found to false.
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 18bc502..b36acbe 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -1406,7 +1406,7 @@ tree
gfc_get_tree_for_caf_expr (gfc_expr *expr)
{
tree caf_decl;
- bool found;
+ bool found = false;
gfc_ref *ref;
gcc_assert (expr && expr->expr_type == EXPR_VARIABLE);