BUG: Index arrays need to be cast with SAME_KIND or FORCE casting

When checking index arrays for out of bound values, safe casting
was used. In principle this is unsafe, but we need to support indexing
with a 64bit integer array on 32bit systems.

Closes gh-4328