[SERVER-18913] Coverity analysis defect 72775: Redundant test Created: 10/Jun/15  Updated: 19/Sep/15  Resolved: 23/Jul/15

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

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Qingyang Chen
Resolution: Done Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Quint Iteration 7
Participants:

 Description   

Test always evaluates the same

Defect 72775 (STATIC_C)
Checker DEADCODE (subcategory redundant_test)
File: /src/mongo/db/exec/count.cpp
Function mongo::CountStage::work(unsigned long *)
/src/mongo/db/exec/count.cpp, line: 124
Condition "mongo::PlanStage::IS_EOF == state", taking false branch. Now the value of "state" cannot be equal to 1.

            if (PlanStage::IS_EOF == state) {

/src/mongo/db/exec/count.cpp, line: 131
Condition "mongo::PlanStage::FAILURE == state", taking false branch. Now the value of "state" cannot be equal to any of {1, 4, 5}.

            else if (PlanStage::FAILURE == state || PlanStage::DEAD == state) {

/src/mongo/db/exec/count.cpp, line: 128
Condition "mongo::PlanStage::DEAD == state", taking false branch. Now the value of "state" cannot be equal to any of {1, 4}.

            else if (PlanStage::DEAD == state) {

/src/mongo/db/exec/count.cpp, line: 131
At condition "mongo::PlanStage::DEAD == state", the value of "state" cannot be equal to any of {1, 4, 5}.

            else if (PlanStage::FAILURE == state || PlanStage::DEAD == state) {

/src/mongo/db/exec/count.cpp, line: 131
The condition "mongo::PlanStage::DEAD == state" cannot be true.

            else if (PlanStage::FAILURE == state || PlanStage::DEAD == state) {



 Comments   
Comment by Githook User [ 28/Jul/15 ]

Author:

{u'username': u'coollog', u'name': u'Qingyang Chen', u'email': u'qingyang.chen@10gen.com'}

Message: SERVER-18913 Remove redundant test in CountStage::work()
Branch: master
https://github.com/mongodb/mongo/commit/cd5bff570f1e17e43cbd81d9eb56fa6097c18b3c

Comment by Githook User [ 23/Jul/15 ]

Author:

{u'username': u'coollog', u'name': u'Qingyang Chen', u'email': u'qingyang.chen@10gen.com'}

Message: SERVER-18913 Remove redundant test in CountStage::work()
Branch: master
https://github.com/mongodb/mongo/commit/cd5bff570f1e17e43cbd81d9eb56fa6097c18b3c

Comment by J Rassi [ 15/Jun/15 ]

James, this looks like a legitimate bug report. Assigning to you for 3.1.5.

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