OSDN Git Service
(root)
/
android-x86
/
external-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3bababf
)
avoid undef behavior on minint, fixing PR7783.
author
Chris Lattner
<sabre@nondot.org>
Tue, 3 Aug 2010 16:41:24 +0000
(16:41 +0000)
committer
Chris Lattner
<sabre@nondot.org>
Tue, 3 Aug 2010 16:41:24 +0000
(16:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110114
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
8054ae6
..
ac118a9
100644
(file)
--- a/
lib/Support/raw_ostream.cpp
+++ b/
lib/Support/raw_ostream.cpp
@@
-143,9
+143,10
@@
raw_ostream &raw_ostream::operator<<(unsigned long long N) {
}
raw_ostream &raw_ostream::operator<<(long long N) {
- if (N <
0) {
+ if (N < 0) {
*this << '-';
- N = -N;
+ // Avoid undefined behavior on INT64_MIN with a cast.
+ N = -(unsigned long long)N;
}
return this->operator<<(static_cast<unsigned long long>(N));