While testing some FORTRAN 90 code under Fedora Core 4,
I found problem initializing COMPLEX PARAMETERs with other
parameters that have + or - in front of the variable name.

The following .f90 test code will illustrate the problem.
All lines should compile fine.
The lines that fail are commented with "fail"

module consts_test

  real(8), parameter :: konst1 = 1.0d0

  complex, parameter :: const1 = (1.0d0,1.0d0)        ! good
  complex, parameter :: const2 = (1.0d0,-1.0d0)       ! good
  complex, parameter :: const3 = (-1.0d0,-1.0d0)      ! good
  complex, parameter :: const4 = (-1.0d0,1.0d0)       ! good
  complex, parameter :: const5 = (+1.0d0,+1.0d0)      ! good
  complex, parameter :: const6 = (konst1,konst1)      ! good
  complex, parameter :: const7 = (konst1,-konst1)     ! fail
  complex, parameter :: const8 = (-konst1,-konst1)    ! fail
  complex, parameter :: const9 = (-konst1,konst1)     ! fail
  complex, parameter :: const10 = (+konst1,+konst1)   ! fail

end module consts_test

!! GNU Fortran 95 (GCC 4.0.0 20050519 (Red Hat 4.0.0-8))
!! Copyright (C) 2005 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

-- 
           Summary: gfortran .f90 complex parameter initialization syntax
                    bug
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: christopherbuell at mindspring dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to