Added code to avoid checking for .bc when the filename is too short.
authorJohn Criswell <criswell@uiuc.edu>
Thu, 28 Aug 2003 21:42:29 +0000 (21:42 +0000)
committerJohn Criswell <criswell@uiuc.edu>
Thu, 28 Aug 2003 21:42:29 +0000 (21:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8190 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llc/llc.cpp

index 9673343306782782fda99f2501e0ddcb0272990a..6a769d8f54fc6f2959905b8d1b74a69a52d9071c 100644 (file)
@@ -44,7 +44,8 @@ GetFileNameRoot(const std::string &InputFilename)
   std::string IFN = InputFilename;
   std::string outputFilename;
   int Len = IFN.length();
-  if (IFN[Len-3] == '.' && IFN[Len-2] == 'b' && IFN[Len-1] == 'c') {
+  if ((Len > 2) &&
+      IFN[Len-3] == '.' && IFN[Len-2] == 'b' && IFN[Len-1] == 'c') {
     outputFilename = std::string(IFN.begin(), IFN.end()-3); // s/.bc/.s/
   } else {
     outputFilename = IFN;