mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-02 15:51:54 +00:00
TableGen: Avoid undefined behaviour by doing this shift in int64
Found by ubsan. This was taking a bool and left shifting by 32 - the result is 64 bit, so we should really do the math in a type it fits in. llvm-svn: 237345
This commit is contained in:
parent
6a3db617a1
commit
68ade96178
@ -230,7 +230,7 @@ Init *IntRecTy::convertValue(BitsInit *BI) {
|
||||
int64_t Result = 0;
|
||||
for (unsigned i = 0, e = BI->getNumBits(); i != e; ++i)
|
||||
if (BitInit *Bit = dyn_cast<BitInit>(BI->getBit(i)))
|
||||
Result |= Bit->getValue() << i;
|
||||
Result |= static_cast<int64_t>(Bit->getValue()) << i;
|
||||
else
|
||||
return nullptr;
|
||||
return IntInit::get(Result);
|
||||
|
Loading…
x
Reference in New Issue
Block a user