[mcs] Check type of index used in pointer array aritmetic. Fixes #17145