diff mbox

[fortran] PR 63701 Make sure variable is always used initialised

Message ID 5461EAB9.6020200@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov Nov. 11, 2014, 10:53 a.m. UTC
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.

Comments

FX Coudert Nov. 11, 2014, 11:25 a.m. UTC | #1
> 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.<init-found.patch>

OK, thanks for the patch.

FX
diff mbox

Patch

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);