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

            Bug ID: 59537
           Summary: "Automatic array cannot have an initializer", for
                    -finit-real and a SAVE statement present in subroutine
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bugs at stellardeath dot org

Created attachment 31461
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31461&action=edit
Minimal example code

The following valid, minimal example code

      subroutine foo(n)
      implicit none
      integer n
      real :: a(1:n)
      save
      a(1) = 3
      end subroutine foo

cannot be compiled with -finit-real. The presence of the catch-all SAVE
statement seems to affect this, even though it should not apply to the
automatic array a (right?):

#> gfortran -finit-real=nan -c minimal.f90
minimal.f:4.20:

      real :: a(1:n)                                                    
                    1
Error: Automatic array 'a' at (1) cannot have an initializer
#>

Without the SAVE statement it compiles fine.

I see this with the installed gfortran 4.8.2 from openSUSE and also with a
self-compiled gfortran from today (2013-12-17):

#> gfortran --version
GNU Fortran (SUSE Linux) 4.8.2 20131210 [gcc-4_8-branch revision 205857]
Copyright (C) 2013 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING


#> ~/sys/stow/gcc-2013-12-17/bin/gfortran --version
GNU Fortran (GCC) 4.9.0 20131217 (experimental)
Copyright (C) 2013 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

Reply via email to