xref: /freebsd/bin/sh/tests/expansion/arith11.0 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
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