From: Stefan Schulze Frielinghaus Date: Mon, 27 Apr 2020 16:09:07 +0000 (+0200) Subject: tree-optimization: Fix use of uninitialized variable [PR94774] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1657178f59bf0c5b269a668bcdcc432fac3bbdd0;p=gcc.git tree-optimization: Fix use of uninitialized variable [PR94774] Array retval is not necessarily initialized by function is_call_safe and may be used afterwards. Thus, initialize it explicitly. gcc/ChangeLog: 2020-04-29 Stefan Schulze Frielinghaus PR tree-optimization/94774 * gimple-ssa-sprintf.c (try_substitute_return_value): Initialize variable retval. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a1100623dc9..f33193b0ec0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-04-29 Stefan Schulze Frielinghaus + + PR tree-optimization/94774 + * gimple-ssa-sprintf.c (try_substitute_return_value): Initialize + variable retval. + 2020-04-29 Richard Sandiford * calls.h (cxx17_empty_base_field_p): Turn into a function declaration. diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index 1879686ce0a..011c3e21e63 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -4120,7 +4120,7 @@ try_substitute_return_value (gimple_stmt_iterator *gsi, bool removed = false; /* The minimum and maximum return value. */ - unsigned HOST_WIDE_INT retval[2]; + unsigned HOST_WIDE_INT retval[2] = {0}; bool safe = is_call_safe (info, res, true, retval); if (safe