In the original version of OP there was an array AAA(np,nd). I guess that internally, the processor should deal properly even with AAA(100000,100000) although the indices would overflow when simply multiplied.
In explicit calculations, however, one has to make sure there is no overflow and use proper kind(s). Note also, that with your declarations:
integer(kind=i4) :: np,nd
integer(kind=i8) :: jjj
jjj = np*nd
jjj will not be properly assigned if np*nd overflows in i4 kind. Consider sample program:
program main
use iso_fortran_env, only: i4=>int32, i8=>int64
integer(i4) :: i=100000, j=100000
integer(i8) :: bi,bj
bi = i*j ! overflows, assigns bad value
bj = int(i,kind=i8)*j ! converted to i8 before multiplication
print *, bi, bj
end program main
! outputs: 1410065408 10000000000