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

Marc Glisse marc.glisse@inria.fr
Thu Jul 25 09:38:00 GMT 2013


On Thu, 25 Jul 2013, Paolo Carlini wrote:

> On 07/25/2013 10:32 AM, Marc Glisse wrote:
>> On Thu, 25 Jul 2013, Jonathan Wakely wrote:
>> 
>>> On 25 July 2013 07:16, Marc Glisse wrote:
>>>> 
>>>> Isn't it this PR?
>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51965
>>> 
>>> Yes, I suppose it is, although your suggestion in comment 5 (which I
>>> prefer to the pass-by-reference change) would still trigger the same
>>> check in Coverity, wouldn't it?
>> 
>> Possibly, yes. I don't know if it has any heuristic to inhibit the warning 
>> depending on what the caller looks like.
>> 
>> Note that IIRC the pass by reference version is much easier for the second 
>> occurence (pop_heap) and feels quite natural.
> Completely forgot this PR. Marc, it would be great if you could review the 
> proposed patch...

The patch attached to the PR seems fine to me (assuming it passes testing 
etc), but Jonathan seems to prefer a different approach, so I'll let him 
decide. The testcase that comes with it may need a few changes if it is to 
go in the testsuite.

(I only looked at it as an incremental patch, I didn't try to understand 
why pop_heap calls push_heap)

-- 
Marc Glisse



More information about the Libstdc++ mailing list