https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56670
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manu at gcc dot gnu.org --- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Rich Townsend from comment #0) > ...causes the following bogus warning: If you compile with -fdump-tree-all-all-lineno and look at test.f90.004t.gimple you'll see that gfortran generates: [test.f90:5:0] name_formatD.3382 = 0B; [test.f90:7:0] { integer(kind=4)D.8 D.3383; [test.f90:7:0] if (name_formatD.3382 != 0B) goto L.1D.3384; else goto <D.3391>; ... L.1D.3384: [test.f90:7:0] if (.name_formatD.3381 == 0) goto L.2D.3385; else goto <D.3392>; If the last line is reached, then .name_format is used uninitialized. This cannot happen here, because the first 'if' is always false. However, GCC does not know that without the analysis done when using optimization. With -O1 there is no warning. (That code is quite strange, why test for != 0B after initializing it to 0B?) > uninit_test.f90: In function ‘uninit_test’: > uninit_test.f90:7:0: warning: ‘.name_format’ may be used uninitialized in > this function [-Wmaybe-uninitialized] > name_format = '' > ^ > > (Note also that the warning arises in the main program, and not in a > function as the message suggests). This is the output in a modern gfortran (with colors!): test.f90:7:0: name_format = '' ^ Warning: ‘.name_format’ may be used uninitialized in this function [-Wmaybe-uninitialized]