[SERVER-18923] Coverity analysis defect 72778: Logically dead code Created: 11/Jun/15  Updated: 29/Sep/15  Resolved: 29/Sep/15

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Trivial - P5
Reporter: Coverity Collector User Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding A (10/09/15)
Participants:

 Description   

Code can never be reached because of a logical contradiction

Defect 72778 (STATIC_C)
Checker DEADCODE (subcategory none)
File: /src/mongo/s/version_manager.cpp
Function mongo::checkShardVersion(mongo::DBClientBase *, const std::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::shared_ptr<mongo::ChunkManager>, bool, int)
/src/mongo/s/version_manager.cpp, line: 436
At condition "(bool)1L", the value of "1L" must be between 0 and 1.

            massert( 10429 , errmsg , 0 );

/src/mongo/s/version_manager.cpp, line: 436
The condition "(bool)1L" must be true.

            massert( 10429 , errmsg , 0 );

/src/mongo/s/version_manager.cpp, line: 437
Execution cannot reach this statement: "return true;".

            return true;



 Comments   
Comment by Andy Schwerin [ 29/Sep/15 ]

We could eliminate the "return true" after the "massert(false)", but it's not urgent. It doesn't hurt readability, as is.

Generated at Thu Feb 08 03:49:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.