xref: /dflybsd-src/tools/regression/bin/sh/expansion/arith11.0 (revision 3e3895bf4584c1562faf4533cbd97026ee6a8dcf)
1*3e3895bfSKrzysztof Piecuch# $FreeBSD: head/bin/sh/tests/expansion/arith11.0 218626 2011-02-12 23:44:05Z jilles $
2f5960706SPeter Avalos# Try to divide the smallest integer by -1.
3f5960706SPeter Avalos# On amd64 this causes SIGFPE, so make sure the shell checks.
4f5960706SPeter Avalos
5f5960706SPeter Avalos# Calculate the minimum possible value, assuming two's complement and
6f5960706SPeter Avalos# a certain interpretation of overflow when shifting left.
7f5960706SPeter Avalosminint=1
8f5960706SPeter Avaloswhile [ $((minint <<= 1)) -gt 0 ]; do
9f5960706SPeter Avalos	:
10f5960706SPeter Avalosdone
11f5960706SPeter Avalosv=$( eval ': $((minint / -1))' 2>&1 >/dev/null)
12f5960706SPeter Avalos[ $? -ne 0 ] && [ -n "$v" ]
13