[LLVMbugs] [Bug 4708] New: llvm-prof has cast warnings after r78477

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Aug 11 12:41:12 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=4708

           Summary: llvm-prof has cast warnings after r78477
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Global Analyses
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: idadesub at users.sourceforge.net
                CC: llvmbugs at cs.uiuc.edu, daniel at zuster.org


Created an attachment (id=3303)
 --> (http://llvm.org/bugs/attachment.cgi?id=3303)
patch to fix warnings in llvm-prof.cpp

It looks like r78477 changed a couple of the return types for ProfileInfo to
return doubles instead of unsigned ints, and llvm-prof.cpp wasn't updated to
reflect this. I'm now getting a couple cast warnings from this (I know
gcc-4.1.1 is bad, but the warnings appear to be valid):

/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_pair.h:
In constructor ‘std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with
_U1 = llvm::Function*, _U2 = double, _T1 = llvm::Function*, _T2 = unsigned
int]’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h:2477:
  instantiated from ‘void std::partial_sort(_RandomAccessIterator,
_RandomAccessIterator, _RandomAccessIterator, _Compare) [with
_RandomAccessIterator = __gnu_cxx::__normal_iterator<std::pair<llvm::Function*,
double>*, std::vector<std::pair<llvm::Function*, double>,
std::allocator<std::pair<llvm::Function*, double> > > >, _Compare =
PairSecondSortReverse<llvm::Function*>]’
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h:2666:
  instantiated from ‘void std::__introsort_loop(_RandomAccessIterator,
_RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator =
__gnu_cxx::__normal_iterator<std::pair<llvm::Function*, double>*,
std::vector<std::pair<llvm::Function*, double>,
std::allocator<std::pair<llvm::Function*, double> > > >, _Size = long int,
_Compare = PairSecondSortReverse<llvm::Function*>]’
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h:2749:
  instantiated from ‘void std::sort(_RandomAccessIterator,
_RandomAccessIterator, _Compare) [with _RandomAccessIterator =
__gnu_cxx::__normal_iterator<std::pair<llvm::Function*, double>*,
std::vector<std::pair<llvm::Function*, double>,
std::allocator<std::pair<llvm::Function*, double> > > >, _Compare =
PairSecondSortReverse<llvm::Function*>]’
/scratch/llvm/llvm/tools/llvm-prof/llvm-prof.cpp:169:   instantiated from here
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_pair.h:90:
warning: converting to ‘unsigned int’ from ‘const double’
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_pair.h:
In constructor ‘std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with
_U1 = llvm::BasicBlock*, _U2 = double, _T1 = llvm::BasicBlock*, _T2 = unsigned
int]’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h:2477:
  instantiated from ‘void std::partial_sort(_RandomAccessIterator,
_RandomAccessIterator, _RandomAccessIterator, _Compare) [with
_RandomAccessIterator =
__gnu_cxx::__normal_iterator<std::pair<llvm::BasicBlock*, double>*,
std::vector<std::pair<llvm::BasicBlock*, double>,
std::allocator<std::pair<llvm::BasicBlock*, double> > > >, _Compare =
PairSecondSortReverse<llvm::BasicBlock*>]’
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h:2666:
  instantiated from ‘void std::__introsort_loop(_RandomAccessIterator,
_RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator =
__gnu_cxx::__normal_iterator<std::pair<llvm::BasicBlock*, double>*,
std::vector<std::pair<llvm::BasicBlock*, double>,
std::allocator<std::pair<llvm::BasicBlock*, double> > > >, _Size = long int,
_Compare = PairSecondSortReverse<llvm::BasicBlock*>]’
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h:2749:
  instantiated from ‘void std::sort(_RandomAccessIterator,
_RandomAccessIterator, _Compare) [with _RandomAccessIterator =
__gnu_cxx::__normal_iterator<std::pair<llvm::BasicBlock*, double>*,
std::vector<std::pair<llvm::BasicBlock*, double>,
std::allocator<std::pair<llvm::BasicBlock*, double> > > >, _Compare =
PairSecondSortReverse<llvm::BasicBlock*>]’
/scratch/llvm/llvm/tools/llvm-prof/llvm-prof.cpp:212:   instantiated from here
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_pair.h:90:
warning: converting to ‘unsigned int’ from ‘const double


I've attached a patch that fixes this, but I'm not sure what the consequences
of this patch will do since I've got a bad gcc installed.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list