[SERVER-37694] Coverity analysis defect 105088: Redundant test Created: 22/Oct/18  Updated: 29/Oct/23  Resolved: 25/Oct/18

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 4.1.5

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: coverity, nyc
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Storage NYC 2018-11-05
Participants:
Story Points: 1

 Description   

Test always evaluates the same

Defect 105088 (STATIC_C)
Checker DEADCODE (subcategory redundant_test)
File: /src/mongo/db/storage/biggie/store.h
Function mongo::biggie::RadixStore<std::_cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::_merge3Helper(mongo::biggie::RadixStore<std::cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::Node *, const mongo::biggie::RadixStore<std::cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::Node *, const mongo::biggie::RadixStore<std::cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::Node *, std::vector<mongo::biggie::RadixStore<std::cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::Node *, std::allocator<mongo::biggie::RadixStore<std::cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::_cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::Node *>> &, std::vector<unsigned char, std::allocator<unsigned char>>&)
/src/mongo/db/storage/biggie/store.h, line: 1337
At condition "baseNode", the value of "baseNode" cannot be "NULL".

                    } else if (baseNode && (!otherNode || (otherNode && baseNode != otherNode))) {

/src/mongo/db/storage/biggie/store.h, line: 1312
Condition "baseNode", taking true branch. Now the value of "baseNode" is not "NULL".

                if (!node && !baseNode && !otherNode)

/src/mongo/db/storage/biggie/store.h, line: 1337
The condition "baseNode" must be true.

                    } else if (baseNode && (!otherNode || (otherNode && baseNode != otherNode))) {



 Comments   
Comment by Githook User [ 25/Oct/18 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-37694 Remove redundant branch tests
Branch: master
https://github.com/mongodb/mongo/commit/9d45349074024d19d0a5a0dedce383944e04c23b

Generated at Thu Feb 08 04:46:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.