BR 3392442: correct vmin in overflow_general()

The calculation of vmin in overflow_general() was bogus, causing
silliness like ~80h being warned about in a byte context.

Reported-by: C. Masloch <pushbx@38.de>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
H. Peter Anvin 2017-10-11 13:12:17 -07:00
parent 9e08075278
commit aaefc7fe6b
2 changed files with 7 additions and 1 deletions

View File

@ -461,7 +461,7 @@ static inline bool const_func overflow_general(int64_t value, int bytes)
sbit = (bytes << 3) - 1;
vmax = ((int64_t)2 << sbit) - 1;
vmin = -((int64_t)1 << sbit);
vmin = -((int64_t)2 << sbit);
return value < vmin || value > vmax;
}

6
test/br3392442.asm Normal file
View File

@ -0,0 +1,6 @@
;; Bug report 3392442: invalid warning
and byte [0], ~80h
and byte [0], 0xfff
and byte [0], -256
and byte [0], -257