------- Comment #5 from paul dot richard dot thomas at cea dot fr 2006-06-20 13:49 ------- This fixes the problem: Index: gcc/fortran/primary.c =================================================================== --- gcc/fortran/primary.c (révision 114599) +++ gcc/fortran/primary.c (copie de travail) @@ -1926,6 +1926,18 @@ return MATCH_ERROR; sym = symtree->n.sym; + + /* Hope that this is a function that has not yet been + declared; the need for this comes from the occasional + return from gfc_get_ha_sym_tree of spurious values + for sym->attr.flavor. */ + if (sym->new && sym->refs == 1 && !sym->attr.dimension) + { + gfc_gobble_whitespace (); + if (gfc_peek_char () == '(') + sym->attr.flavor = FL_UNKNOWN; + } + e = NULL; where = gfc_current_locus; I do not understand why spurious values are returning from gfc_get_ha_sym_tree, however. I put diagnostics on the return value and the result; the value just changes! The above, however, will not do any harm and certainly allows the following to run correctly. Paul module foo integer, parameter :: n = 4 contains logical function foot (i) integer, intent(in) :: i foot = (i == 2) .or. (i == 3) end function foot end module foo use foo integer :: i, a(n) logical :: s(n) s = (/(foot (i), i=1, n)/) ! Check that non-mask case is still OK a = 0 forall (i=1:n) a(i) = i if (any (a .ne. (/1,2,3,4/))) call abort () ! Now a mask using a function with an explicit interface ! via use association. a = 0 forall (i=1:n, foot (i)) a(i) = i if (any (a .ne. (/0,2,3,0/))) call abort () ! Now an array variable mask a = 0 forall (i=1:n, .not. s(i)) a(i) = i if (any (a .ne. (/1,0,0,4/))) call abort () ! This was the PR - an internal function mask a = 0 forall (i=1:n, t (i)) a(i) = i if (any (a .ne. (/0,2,0,4/))) call abort () ! Check that an expression is OK a = 0 forall (i=1:n, t (i) .eqv. .false.) a(i) = i if (any (a .ne. (/1,0,3,0/))) call abort () ! And that an expression that used to work is OK a = 0 forall (i=1:n, s (i) .or. t(i)) a(i) = i if (any (a .ne. (/0,2,3,4/))) call abort () contains logical function t(i) integer, intent(in) :: i t = (mod (i, 2) == 0) end function t end -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25072