[SERVER-59465] Coverity analysis defect 120434: Unused value Created: 20/Aug/21  Updated: 29/Oct/23  Resolved: 21/Sep/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Ted Tuckman
Resolution: Fixed Votes: 0
Labels: coverity, greenerbuild, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2021-08-20 at 10.25.43 AM.png    
Issue Links:
Related
is related to SERVER-59466 Coverity analysis defect 120435: Unin... Closed
is related to SERVER-59468 Coverity analysis defect 120437: Miss... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QO 2021-10-04
Participants:

 Description   

Unused value

An assigned value that is never used may represent unnecessary computation, an incorrect algorithm, or possibly the need for cleanup or refactoring. A value assigned to a variable is never used.
/src/mongo/db/pipeline/document_source_densify.h:81: UNUSED_VALUE 120434 Overwriting previous write to "*&<temporary>" with value from "mongo::RangeStatement::serialize() const::[lambda(std::pair<mongo::Date_t, mongo::Date_t>) (instance 1)]()".
/src/mongo/db/pipeline/document_source_densify.h:80: UNUSED_VALUE 120434 Assigning value from "mongo::RangeStatement::serialize() const::[lambda(mongo::RangeStatement::Partition) (instance 1)]()" to "*&<temporary>" here, but that stored value is overwritten before it can be used.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 21/Sep/21 ]

Author:

{'name': 'Ted Tuckman', 'email': 'ted.tuckman@mongodb.com', 'username': 'TedTuckman'}

Message: SERVER-59465 Fix coverity issues in DocumentSourceDensify
Branch: master
https://github.com/mongodb/mongo/commit/c9df76ad4e2f9879cc5cb8ed371f36d2065acccc

Comment by Kyle Suarez [ 20/Aug/21 ]

Yeah – for example, StringData does this in one of its tagged constructors:

    /** Tag used to bypass the invariant of the {c,len} constructor. */
    struct TrustedInitTag {};
    constexpr StringData(const char* c, size_t len, TrustedInitTag) : _data(c), _size(len) {}

Comment by Sam Mercier [ 20/Aug/21 ]

This is intentional. Can such parameters really be omitted? Wouldn't that cause a compiler error?

Comment by Kyle Suarez [ 20/Aug/21 ]

This is for both the Full and Partition parameters in the visitors. (There's a separate Coverity ticket for each, but combined them both here.) If the parameters are meant to be ignored, I'd prefer to omit the parameter name to suppress these warnings.

Generated at Thu Feb 08 05:47:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.