Use size_t to store Pos, avoid truncating value
authorDuncan Sands <baldrick@free.fr>
Tue, 8 Jan 2008 10:06:15 +0000 (10:06 +0000)
committerDuncan Sands <baldrick@free.fr>
Tue, 8 Jan 2008 10:06:15 +0000 (10:06 +0000)
on 64-bit builds.  Analysis and original patch
by Török Edwin.  Code audit found another place
with the same problem, also fixed here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45746 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCSubtarget.cpp
lib/Target/X86/X86Subtarget.cpp

index 0a1e6a78371d9cd1d3ae156974d892bcb07fddfc..dff53baa16b16d3257b968e8a2e9055dcb88a623 100644 (file)
@@ -103,7 +103,7 @@ PPCSubtarget::PPCSubtarget(const TargetMachine &tm, const Module &M,
   const std::string &TT = M.getTargetTriple();
   if (TT.length() > 7) {
     // Determine which version of darwin this is.
-    unsigned DarwinPos = TT.find("-darwin");
+    size_t DarwinPos = TT.find("-darwin");
     if (DarwinPos != std::string::npos) {
       if (isdigit(TT[DarwinPos+7]))
         DarwinVers = atoi(&TT[DarwinPos+7]);
index 7b686edef31658991881d6738f7e1e4314f5a854..6efe540fabd24ea7f503dfdad91e4b04cc3db3ce 100644 (file)
@@ -257,7 +257,7 @@ X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit)
   // if one cannot be determined, to true.
   const std::string& TT = M.getTargetTriple();
   if (TT.length() > 5) {
-    unsigned Pos;
+    size_t Pos;
     if ((Pos = TT.find("-darwin")) != std::string::npos) {
       TargetType = isDarwin;