[llvm-commits] CVS: llvm/utils/fpcmp/fpcmp.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Fri Apr 23 12:38:01 PDT 2004


Changes in directory llvm/utils/fpcmp:

fpcmp.cpp updated: 1.3 -> 1.4

---
Log message:

mmap of a zero length file returns null on some platforms, so hack around it.


---
Diffs of the changes:  (+6 -0)

Index: llvm/utils/fpcmp/fpcmp.cpp
diff -u llvm/utils/fpcmp/fpcmp.cpp:1.3 llvm/utils/fpcmp/fpcmp.cpp:1.4
--- llvm/utils/fpcmp/fpcmp.cpp:1.3	Mon Apr 19 14:09:24 2004
+++ llvm/utils/fpcmp/fpcmp.cpp	Fri Apr 23 12:38:17 2004
@@ -50,6 +50,12 @@
     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) {





More information about the llvm-commits mailing list