[Bug fortran/30400] New: ANY not accepted as mask in FORALL

dominiq at lps dot ens dot fr gcc-bugzilla@gcc.gnu.org
Sun Jan 7 00:46:00 GMT 2007


On OSX 10.3 PPC with gfortran version 4.3.0 20070105, the following code:

! tests FORALL statements with a mask
program forall_8
  real, dimension (5, 5, 5, 5) :: a

  a (:, :, :, :) = 4

  forall (i = 1:5, j = 1:5, k = 1:5, any (a (i, j, k, :) .gt. 6))
    forall (l = 1:5, any (a (:, :, :, l) .lt. 2))
      a (i, j, k, l) = i - j + k - l
    end forall
  end forall

end

gives:

forall10_red.f90:8.20:

    forall (l = 1:5, any (a (:, :, :, l) .lt. 2))
                   1
Error: 'any' at (1) is not a function
forall10_red.f90:8.20:

    forall (l = 1:5, any (a (:, :, :, l) .lt. 2))
                   1
Error: FORALL mask clause at (1) requires a LOGICAL expression
forall10_red.f90:7.36:

  forall (i = 1:5, j = 1:5, k = 1:5, any (a (i, j, k, :) .gt. 6))
                                   1
Error: 'any' at (1) is not a function
forall10_red.f90:7.36:

  forall (i = 1:5, j = 1:5, k = 1:5, any (a (i, j, k, :) .gt. 6))
                                   1
Error: FORALL mask clause at (1) requires a LOGICAL expression

On AMD64 with gfortran version 4.3.0 20061231, I get:

/tmp/ccwGPWn6.s: Assembler messages:
/tmp/ccwGPWn6.s:2: Error: junk at end of line, first unrecognized character is
`('
/tmp/ccwGPWn6.s:5: Error: unrecognized symbol type ""
/tmp/ccwGPWn6.s:5: Error: junk at end of line, first unrecognized character is
`('
/tmp/ccwGPWn6.s:6: Error: expected comma after name `__' in .size directive
/tmp/ccwGPWn6.s:7: Error: invalid character '_' in mnemonic

As noticed by Paul Thomas:

A temporary workaround is to enclose the mask expression in 
parentheses.  Oddly, doing this in match_forall_header, using 
gfc_get_parentheses, does not cure the problem, I am at a loss to 
explain why.


-- 
           Summary: ANY not accepted as mask in FORALL
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dominiq at lps dot ens dot fr
GCC target triplet: powerpc-apple-darwin7


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



More information about the Gcc-bugs mailing list