When I try the following test program, a value is stored into
the first element of the complex array, even though the array
section is zero sized.  It fails with variables for the 
section subscripts and works if I use explicit constants
for the subscripts.

Dick Hendrickson
--------------------------------------------------
C:\g_experiments\gfortran>gfortran ha0020.f

C:\g_experiments\gfortran>a
 first test
           1 (-1.00000000    ,  0.0000000    )
 second test

----------------------------------------------------------


      program  try_ha0020
      call ha0020(1,10,-1,2,-3)
      end program

      SUBROUTINE HA0020(nf1,nf10,mf1,nf2,mf3)
      COMPLEX XCA(20), xda(20)

      do I = 1,20
        xca(i) = i
        xda(i) = -i
      enddo

       XCA(NF1:NF10:MF1) = XDA(NF1:NF2:MF3)    !fails

      print *, 'first test'

      DO J1 = 1,20
        if (xca(j1) .ne. j1) print *, j1, xca(j1)
      enddo
      do I = 1,20
        xca(i) = i
        xda(i) = -i
      enddo

       xca(  1:  10: -1) = xda(  1:  2: -3)    !works

      print *, 'second test'

      DO J1 = 1,20
        if (xca(j1) .ne. j1) print *, j1, xca(j1)
      enddo

      END SUBROUTINE


-- 
           Summary: assignment to run-time zero-sized complex section stores
                    a value
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dick dot hendrickson at gmail dot com


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

Reply via email to