Named forall constructs not recognized.

Although there seems to be no functional reason for doing so, the Fortran 95 standard permits forall constructs to be named. However, the PGI f90/f95 compiler (Version 6.1) does not appear to recognize this.

For example, the following code:

    ! Grid vector:
    grid_v: forall (i=ib:ie, j=jb:je, k=kb:ke) ! Line 82
       gout(i,j,k,1) = z(i,j)*rref*out_len
       gout(i,j,k,2) = r(i,j)*rref*out_len
       gout(i,j,k,3) = dummy
    end forall grid_v                          ! Line 86

    ! Data vector:
    data_v: forall (i=ib:ie, j=jb:je, k=kb:ke) ! Line 89
       qout(i,j,k,1) = u(i,j)*uref*out_vel
       qout(i,j,k,2) = v(i,j)*uref*out_vel
       qout(i,j,k,3) = p(i,j)*pref*out_press
       qout(i,j,k,4) = t(i,j)*tref*out_temp
       qout(i,j,k,5) = cmach(i,j)
    end forall data_v                          ! Line 95

causes the following compiler errors:

PGF90-S-0034-Syntax error at or near FORALL (plot3d.f90: 82)
PGF90-S-0034-Syntax error at or near identifier grid_v (plot3d.f90: 86)
PGF90-S-0034-Syntax error at or near FORALL (plot3d.f90: 89)
PGF90-S-0034-Syntax error at or near identifier data_v (plot3d.f90: 95)
0 inform, 0 warnings, 4 severes, 0 fatal for plot3d

For consistency and readability, I like to name most loop structures in my code, so I’m a bit disappointed that the PGI compiler appears not to support the standard in this respect. I definitely dislike having to alter standards-compliant code in order to please a particular compiler.

Hi chylin,

Thank you for your report. This is indeed a bug and I have filed a technical problem report, TPR #3838, for this issue.

  • Mat

Thanks, Mat.

For the time being, I’ve removed the name-tags from the forall loops in question, and put equivalent comments at the end of those lines. With that work-around, the routine compiles okay.