The ANY, ALL, and COUNT intrinsics do not return the correct answer when the MASK array is a zero sized section of an array. The whole array reduction versions give the correct answer for the zero sized whole array argument. It appears as if nothing is being stored on the left hand side.
Dick Hendrickson program try_gf0026_etc ! fails on Windows XP ! gcc version 4.4.0 20080312 (experimental) [trunk revision 133139] call gf0026( 0, 1) end program SUBROUTINE GF0026(nf0,nf1) LOGICAL LDA(9) INTEGER IDA(NF0,9), iii(9) lda = (/ (i/2*2 .eq. I, i=1,9) /) LDA = ALL ( IDA .NE. -1000, 1) print *, lda !expect TRUE print *, all(ida .ne. -1000) !expect TRUE lda = (/ (i/2*2 .eq. I, i=1,9) /) LDA = any ( IDA .NE. -1000, 1) print *, lda !expect FALSE print *, any(ida .ne. -1000) !expect FALSE iii = 137 iii = count ( IDA .NE. -1000, 1) print '(9i4)', iii !expect 0 print *, count(ida .ne. -1000) !expect COUNT END SUBROUTINE C:\gfortran:gfortran gf0026.f C:\gfortran:a F T F T F T F T F T F T F T F T F T F F 137 137 137 137 137 137 137 137 137 0 -- Summary: ANY, ALL, and COUNT errors for zero sized sections 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=35995