projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
abf5bf2
)
Support: Remove undefined behavior from &raw_ostream::operator<<
author
David Majnemer
<david.majnemer@gmail.com>
Fri, 26 Sep 2014 02:48:14 +0000
(
02:48
+0000)
committer
David Majnemer
<david.majnemer@gmail.com>
Fri, 26 Sep 2014 02:48:14 +0000
(
02:48
+0000)
Don't negate signed integer types in &raw_ostream::operator<<(const
FormattedNumber &FN).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218496
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Support/raw_ostream.cpp
patch
|
blob
|
history
diff --git
a/lib/Support/raw_ostream.cpp
b/lib/Support/raw_ostream.cpp
index 0fd0cdfa937a1aa825cc945a8d363989b58cfb41..c2c55cff7ed9ee600cf3723807c08ba589187124 100644
(file)
--- a/
lib/Support/raw_ostream.cpp
+++ b/
lib/Support/raw_ostream.cpp
@@
-433,7
+433,7
@@
raw_ostream &raw_ostream::operator<<(const FormattedNumber &FN) {
char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
char *CurPtr = EndPtr;
bool Neg = (FN.DecValue < 0);
- uint64_t N = Neg ? -
FN.DecValue
: FN.DecValue;
+ uint64_t N = Neg ? -
static_cast<uint64_t>(FN.DecValue)
: FN.DecValue;
while (N) {
*--CurPtr = '0' + char(N % 10);
N /= 10;