Test for #1510: Crash: nested for-loop weirdness

Seems to have been fixed by #1511 fix