http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57127

             Bug #: 57127
           Summary: gfortran gives unintended warning on uninitialized
                    optional dummy array of undetermined size
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: astrofl...@gmail.com


Created attachment 29985
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29985
Source file example.f90 used in the example in the bug report

gfortran-4.7.2 -O1 -Wall gives unintended warning about uninitialized array
elements when a routine is called with an optional dummy array of undetermined
size (example.f90 is attached below):

$ gfortran -O1 -Wall example.f90 -o example && ./example
example.f90: In function ‘example_routine’:
example.f90:8:0: warning: ‘array.0’ may be used uninitialized in this function
[-Wmaybe-uninitialized]

Expected behaviour: no warning message.

The warning goes away when:
  * -O0 is used rather than -O1 or higher
  * -Wall is replaced by -Wmaybe-uninitialized
  * the line  write(op,'(A)') 'foo'  is commented out

Reply via email to