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

             Bug #: 51815
           Summary: confusing substring syntax with array section for
                    character coarray
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: lo...@cray.com


For this test:

> cat test.f90
PROGRAM caf_test_P0201R
   implicit none
   character(10) :: s[*]
   character(18) :: d = 'ABCDEFGHIJKLMNOPQR'
   integer       :: img

   img = this_image()
   s = d(img:img+9)
   print *, img, s
   print *, img, s(2:4)
END PROGRAM

> gfortran -fcoarray=single test.f90
test.f90:10.18:

   print *, img, s(2:4)
                  1
Error: Rank mismatch in array reference at (1) (1/0)

The character variable s is not an array. The compiler appears to be confusing
the substring syntax with an array section. 

Subclause 6.4.1 [118:9-15] indicates that this is allowed syntax. (coindexed
<parent-string>)

Reply via email to