BUG: fix potentially infinite recursion in VOID_nonzero. Fixes #3312.
TST: add a test for issue #3312