Fix #7095, sum along first dimension broken for size(A, 1) >= 16

This was broken by #7061. I have added a test to avoid future breakage.