Remove undefined behavior from bit-shifting code
authorTim Haines <thaines.astro@gmail.com>
Thu, 7 Feb 2019 22:33:13 +0000 (16:33 -0600)
committerGitHub <noreply@github.com>
Thu, 7 Feb 2019 22:33:13 +0000 (16:33 -0600)
commitd6f7ae96cc9d06e827e8b0cad7aaaf7d3d020e6a
tree892aa760a2ea89864ff33bdcf14adce817383dec
parent86512d5fea1c675950291ac735ba15ee1205a8c7
Remove undefined behavior from bit-shifting code

PR #536

Overflow of signed integer arithmetic (including shifting) is
undefined behavior in C++. Compilers are allowed to exploit
this UB for optimization purposes up to and including not
emitting any opcodes.

These were found using cppcheck.
dataflowAPI/rose/semantics/DispatcherPowerpc.C
dyninstAPI/src/codegen-aarch64.C
dyninstAPI/src/codegen-x86.C
dyninstAPI/src/inst-x86.C
instructionAPI/src/InstructionDecoder-aarch64.h