Message ID | 20211031162558.3254777-1-rep.dot.nop@gmail.com |
---|---|
State | New |
Headers | show |
Series | Fortran: Silence -Wmaybe-uninitialized warning | expand |
Hi Bernhard, > gcc/fortran/ChangeLog: > > * resolve.c (resolve_fl_procedure): Initialize > allocatable_or_pointer. Looking at the code, it is clear that this is a false positive, or a false maybe, but the semantics of C/C++ may well indicate that sym->result could change, although it clearly does not. So, OK. Thanks for the patch! Best regards Thomas
On Sun, 31 Oct 2021 18:05:36 +0100 Thomas Koenig <tkoenig@netcologne.de> wrote: > Hi Bernhard, > > > gcc/fortran/ChangeLog: > > > > * resolve.c (resolve_fl_procedure): Initialize > > allocatable_or_pointer. > > Looking at the code, it is clear that this is a false > positive, or a false maybe, but the semantics of C/C++ > may well indicate that sym->result could change, although > it clearly does not. Agree wholeheartedly > > So, OK. pushed as r12-4811 > > Thanks for the patch! I have to thank you for the quick review! cheers,
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 8da396b32ec..21126cba262 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -13179,7 +13179,7 @@ static bool resolve_fl_procedure (gfc_symbol *sym, int mp_flag) { gfc_formal_arglist *arg; - bool allocatable_or_pointer; + bool allocatable_or_pointer = false; if (sym->attr.function && !resolve_fl_var_and_proc (sym, mp_flag))
From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org> gcc/fortran/ChangeLog: * resolve.c (resolve_fl_procedure): Initialize allocatable_or_pointer. --- fortran/resolve.c: In function 'bool resolve_fl_procedure(gfc_symbol*, int)': fortran/resolve.c:13391:7: warning: 'allocatable_or_pointer' may be used uninitialized in this function [-Wmaybe-uninitialized] 13390 | if (sym->attr.elemental && sym->result | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 13391 | && allocatable_or_pointer) | ^~~~~~~~~~~~~~~~~~~~~~~~~ .../fortran/resolve.c:13197:8: note: 'allocatable_or_pointer' was declared here 13197 | bool allocatable_or_pointer; | ^~~~~~~~~~~~~~~~~~~~~~ Bootstrapped and regtested without regressions. Ok for trunk? --- gcc/fortran/resolve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)