mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
Fix undefined behavior (left shift by 64 bits) in ScaledNumber::toString().
This bug is reported by UBSan. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216116 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3deb3e32b2
commit
242320399f
@ -220,6 +220,9 @@ std::string ScaledNumberBase::toString(uint64_t D, int16_t E, int Width,
|
||||
} else if (E > -64) {
|
||||
Above0 = D >> -E;
|
||||
Below0 = D << (64 + E);
|
||||
} else if (E == -64) {
|
||||
// Special case: shift by 64 bits is undefined behavior.
|
||||
Below0 = D;
|
||||
} else if (E > -120) {
|
||||
Below0 = D >> (-E - 64);
|
||||
Extra = D << (128 + E);
|
||||
|
Loading…
Reference in New Issue
Block a user