foreach: make test more accurate, fix for 64-bit gcc 4.4.3