Bug 56670 - Allocatable-length character var causes bogus warning with -Wall
Summary: Allocatable-length character var causes bogus warning with -Wall
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks: Wuninitialized 45170
  Show dependency treegraph
 
Reported: 2013-03-20 20:38 UTC by Rich Townsend
Modified: 2015-08-07 20:34 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-03-22 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rich Townsend 2013-03-20 20:38:51 UTC
Compiling this short test case with the -Wall option:

program uninit_test

  implicit none

  character(LEN=:), allocatable :: name_format

  name_format = ''

end program uninit_test

...causes the following bogus warning:

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

gfortran -v:

Using built-in specs.
COLLECT_GCC=/Applications/madsdk/bin/gfortran.exec
COLLECT_LTO_WRAPPER=/Applications/madsdk/libexec/gcc/x86_64-apple-darwin11.4.2/4.8.0/lto-wrapper
Target: x86_64-apple-darwin11.4.2
Configured with: ./configure CC='gcc -D_FORTIFY_SOURCE=0' --build=x86_64-apple-darwin11.4.2 --prefix=/Applications/madsdk --with-gmp=/Applications/madsdk --with-mpfr=/Applications/madsdk --with-mpc=/Applications/madsdk --enable-languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 4.8.0 20130314 (experimental) (GCC)
Comment 1 Dominique d'Humieres 2014-03-22 15:46:34 UTC
Confirmed from 4.6 to trunk (4.9).
Comment 2 Manuel López-Ibáñez 2015-02-23 17:57:13 UTC
Fix blocks/depends list.
Comment 3 Mikael Morin 2015-08-07 20:26:04 UTC
Possibly related: PR60500