This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Coverity complains "Big parameter passed by value" in /usr/include/c++/4.6/bits/stl_heap.h
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Dan Kegel <dank at kegel dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 25 Jul 2013 00:19:49 +0100
- Subject: Re: Coverity complains "Big parameter passed by value" in /usr/include/c++/4.6/bits/stl_heap.h
- References: <CAPF-yOaBvKa5THPBsN0Rx2j9r32pdbDLHU8f+rt_Pfzdtq12vQ at mail dot gmail dot com>
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.