--------------------------------------------
program test_gfortran

implicit none

   !test case 1, similar to PR26074
   integer, parameter :: len = 1
   integer, parameter :: arr(max(len,1)) = (/1/)

   !test case 2
   character(len=*), dimension (1),             parameter :: specStr =
(/'string'/)
   double precision, dimension (size(specStr)), parameter :: specNum =
(/99.0d0/)

end
--------------------------------------------



This results in:

--------------------------------------------
$gfortran-4.2 -c  test_gfortran.f90
test_gfortran.f90:7.39:

   integer,parameter :: arr(max(len,1)) = (/1/)
                                      1
Error: Parameter array 'arr' at (1) cannot be automatic or assumed shape
test_gfortran.f90:11.68:

   double precision, dimension (size(specStr)), parameter :: specNum = (/99.0d0
                                                                   1
Error: Parameter array 'specnum' at (1) cannot be automatic or assumed shape
--------------------------------------------



This is somehow similar to PR26074 (which is fixed and works). NAG and Lahey
Fortran compiler work with this code. See
http://gcc.gnu.org/ml/fortran/2007-07/msg00486.html


-- 
           Summary: Error: Parameter array ... cannot be automatic or
                    assumed shape
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: flad at gmx dot at


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

Reply via email to