summaryrefslogtreecommitdiffstats
path: root/llvm/utils/fpcmp
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2004-04-23 17:38:17 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2004-04-23 17:38:17 +0000
commit11550c1deb60de3e30ce5866d0c5c2aa0f3dbf8a (patch)
tree88bb4d49d5c74473a96c6abf32b52c23bd12a664 /llvm/utils/fpcmp
parent6e102a7edd9d61848d10a94cf218e59d8eea7272 (diff)
downloadbcm5719-llvm-11550c1deb60de3e30ce5866d0c5c2aa0f3dbf8a.tar.gz
bcm5719-llvm-11550c1deb60de3e30ce5866d0c5c2aa0f3dbf8a.zip
mmap of a zero length file returns null on some platforms, so hack around it.
llvm-svn: 13121
Diffstat (limited to 'llvm/utils/fpcmp')
-rw-r--r--llvm/utils/fpcmp/fpcmp.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/utils/fpcmp/fpcmp.cpp b/llvm/utils/fpcmp/fpcmp.cpp
index 6f8298e5c78..7e472d474f6 100644
--- a/llvm/utils/fpcmp/fpcmp.cpp
+++ b/llvm/utils/fpcmp/fpcmp.cpp
@@ -50,6 +50,12 @@ static void OpenFile(const std::string &Filename, unsigned &Len, char* &BufPtr){
std::cerr << "Error: cannot open file '" << Filename << "'\n";
exit(2);
}
+
+ // If mmap decided that the files were empty, it might have returned a
+ // null pointer. If so, make a new, fake pointer -- it shouldn't matter
+ // what it contains, because Len is 0, and it should never be read.
+ if (BufPtr == 0 && Len == 0)
+ BufPtr = new char[1];
}
static bool isNumberChar(char C) {
OpenPOWER on IntegriCloud