Problem with pointer arithmetic for a filtering algorithm

I think I should check this code and see what it does. The error message itself is to some degree a hint.