fix Issue 10842 - Some integer casts wrongly remove side-effect of the operand