https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87212

            Bug ID: 87212
           Summary: Declaration with array constructor: Error message on
                    valid code
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juergen.reuter at desy dot de
  Target Milestone: ---

The following is from c.l.f. Jan 26, 2018 but seems to never have been filed as
a bug report here (?), though Dominique d'Humieres presented a workaround for
the code below.
The following standard-conforming code is not parsed correctly by gfortran:
bug.f90:7:18:

7 |        [(product([(j,j=1,i)]),i=0,13)]
  |                  1
Error: Invalid character in name at (1)

The problem dates back to at least gfortran 5.4.

program bug
use ISO_FORTRAN_ENV
implicit none
integer i
integer(INT64) j
integer(INT64), parameter :: A(0:13) = &
[(product([(j,j=1,i)]),i=0,13)]
integer(INT64) B(0:13)
B = [(product([(j,j=1,i)]),i=0,13)]
write(*,*) 'A ='
write(*,*) A
write(*,*) 'B ='
write(*,*) B
end program bug

Reply via email to