add test for #4075 and fix signed/unsigned comparison