https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68560
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I see the same problem with
program test_count
integer, dimension(2,3) :: a, b
logical, dimension(2,3) :: mask
integer :: i(2), j(3)
a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
mask = a.ne.b
j=count(mask, 1, kind=4)
i=count(mask, 2)
end program test_count
...
_gfortran_count_4_l (&parm.4, D.3452, D.3454);
...
_gfortran_count_4_l (&parm.6, D.3463, D.3465, D.3467);
...