This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]