Coverity analysis defect 98850: Logically dead code

XMLWordPrintableJSON

    • Fully Compatible
    • ALL
    • Integrate+Tuning 14 (05/13/16)
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Code can never be reached because of a logical contradiction

      Defect 98850 (STATIC_C)
      Checker DEADCODE (subcategory none)
      File: /src/mongo/db/storage/key_string.cpp
      Function mongo::KeyString::_appendNumberDecimal(mongo::Decimal128, bool)
      /src/mongo/db/storage/key_string.cpp, line: 703
      Condition "hasFraction", taking true branch. Now the value of "hasFraction" is equal to 1.

                  if (!hasFraction)
      

      /src/mongo/db/storage/key_string.cpp, line: 708
      At condition "hasFraction", the value of "hasFraction" must be equal to 1.

                      uint8_t dcm = hasFraction ? kDCMHasContinuationLargerThanDoubleRoundedUpTo15Digits
      

      /src/mongo/db/storage/key_string.cpp, line: 708
      The condition "hasFraction" must be true.

                      uint8_t dcm = hasFraction ? kDCMHasContinuationLargerThanDoubleRoundedUpTo15Digits
      

      /src/mongo/db/storage/key_string.cpp, line: 708
      Execution cannot reach the expression "mongo::KeyString::kDCMEqualToDouble" inside this statement: "dcm = (hasFraction ? mongo:...".

                      uint8_t dcm = hasFraction ? kDCMHasContinuationLargerThanDoubleRoundedUpTo15Digits
      

            Assignee:
            Geert Bosch
            Reporter:
            Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: