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