xref: /freebsd/bin/sh/tests/expansion/arith11.0 (revision edf8578117e8844e02c0121147f45e4609b30680)
1# Try to divide the smallest integer by -1.
2# On amd64 this causes SIGFPE, so make sure the shell checks.
3
4# Calculate the minimum possible value, assuming two's complement and
5# a certain interpretation of overflow when shifting left.
6minint=1
7while [ $((minint <<= 1)) -gt 0 ]; do
8	:
9done
10v=$( eval ': $((minint / -1))' 2>&1 >/dev/null)
11[ $? -ne 0 ] && [ -n "$v" ]
12