[Bug 37117] New: PVS-Studio Error: Shifting a negative number
wine-bugs at winehq.org
wine-bugs at winehq.org
Sat Aug 16 12:58:36 CDT 2014
https://bugs.winehq.org/show_bug.cgi?id=37117
Bug ID: 37117
Summary: PVS-Studio Error: Shifting a negative number
Product: Wine
Version: 1.7.22
Hardware: x86-64
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: -unknown
Assignee: wine-bugs at winehq.org
Reporter: lukebenes at hotmail.com
PVS-Studio Error: V610 Undefined behavior. Check the shift operator '<<. The
left operand '(LONGLONG) - 1' is negative. propvar.c 127
...
if (*res >= ((LONGLONG)1 << (dest_bits-1)) ||
*res < ((LONGLONG)-1 << (dest_bits-1)))
return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
...
The LONGLONG type is declared as 'typedef signed __int64 LONGLONG;', i.e. it is
a signed type. According to the new standard, shifting negative numbers leads
to undefined or unspecified behavior. To find out why such code still may work
and how to fix it best, see the article Wade not in unknown waters - part
three.
details on the V610 error here: http://www.viva64.com/en/d/0225/
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list