Created attachment 192294 [details] Patch to fix the issue It is possible to trigger an overflow error message with expr, even though no overflow would occur: $ expr -- -36854775800 - \( -9223372036854775807 - 1 \) expr: overflow $ _ The function assert_minus() verifies subtraction in an invert addition case, which is not correct. See also the OpenBSD discussion here: https://marc.info/?l=openbsd-tech&m=152245790622327&w=2
Looks correct to me.
Thanks!
A commit references this bug: Author: cem Date: Sat Apr 14 04:35:10 UTC 2018 New revision: 332499 URL: https://svnweb.freebsd.org/changeset/base/332499 Log: expr(1): Fix overflow detection when operand is INTMAX_MIN PR: 227329 Submitted by: Tobias Stoeckmann <tobias AT stoeckmann.org> Changes: head/bin/expr/expr.y