See Section 2.6.5 (sumInt32Dbl) for detail. This routine is the front-end of that, namely the function version, just like the Fortran90 builtin function sum() but returns always Integer(int32).
Note that if the returned value is INTEGER_NULL, the caller side then can execute sum(real(ary, double)) in order to get the total sum, in the double-precission float number this time.
interface sumInt32 integer(int32) function sumInt32Int81d(ary) integer(int8), intent(in) :: ary(:) end function sumInt32Int81d integer(int32) function sumInt32Int82d(ary) integer(int8), intent(in) :: ary(:,:) end function sumInt32Int82d integer(int32) function sumInt32Int83d(ary) integer(int8), intent(in) :: ary(:,:,:) end function sumInt32Int83d integer(int32) function sumInt32Int84d(ary) integer(int8), intent(in) :: ary(:,:,:,:) end function sumInt32Int84d integer(int32) function sumInt32Int161d(ary) integer(int16), intent(in) :: ary(:) end function sumInt32Int161d integer(int32) function sumInt32Int162d(ary) integer(int16), intent(in) :: ary(:,:) end function sumInt32Int162d integer(int32) function sumInt32Int163d(ary) integer(int16), intent(in) :: ary(:,:,:) end function sumInt32Int163d integer(int32) function sumInt32Int164d(ary) integer(int16), intent(in) :: ary(:,:,:,:) end function sumInt32Int164d integer(int32) function sumInt32Int321d(ary) integer(int32), intent(in) :: ary(:) end function sumInt32Int321d integer(int32) function sumInt32Int322d(ary) integer(int32), intent(in) :: ary(:,:) end function sumInt32Int322d integer(int32) function sumInt32Int323d(ary) integer(int32), intent(in) :: ary(:,:,:) end function sumInt32Int323d integer(int32) function sumInt32Int324d(ary) integer(int32), intent(in) :: ary(:,:,:,:) end function sumInt32Int324d end interface