Coverity complains "Big parameter passed by value" in /usr/include/c++/4.6/bits/stl_heap.h

Jonathan Wakely jwakely.gcc@gmail.com
Wed Jul 24 23:19:00 GMT 2013


On 24 July 2013 23:55, Dan Kegel wrote:
>
> I'm using Coverity on a project built with gcc-4.6.3 (Ubuntu's version).
> It recently issued a complaint about /usr/include/c++/4.6/bits/stl_heap.h:
>
> 170      _ValueType __value = _GLIBCXX_MOVE(*(__last - 1));
> 171      std::__push_heap(__first, _DistanceType((__last - __first) - 1),
> 172                       _DistanceType(0), _GLIBCXX_MOVE(__value));
> 173    }
> 174
> 175  template<typename _RandomAccessIterator, typename _Distance, typename _Tp,
> 176           typename _Compare>
> 177    void
> 178    __push_heap(_RandomAccessIterator __first, _Distance __holeIndex,
>
> CID 10892: Big parameter passed by value (PASS_BY_VALUE)
> pass_by_value: Passing parameter __value of type Request (size 160
> bytes) by value.
> 179                _Distance __topIndex, _Tp __value, _Compare __comp)

Something is using a heap of "Request" objects, and they're 160 bytes
each and passed by value (with C++11 move semantics when applicable)
because that's what std::push_heap requires. "Request" is not a type
from libstdc++, it's part of your project or something it uses. The
push_heap function just does what it's asked to, libstdc++ can't do
much more about that than use std::move(), which it already does.



More information about the Libstdc++ mailing list