Uploaded image for project: 'SonarCFamily'
  1. SonarCFamily
  2. CPP-2017

Fix false-positives for comparisons between unsigned and negatives

    XMLWordPrintable

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.7
    • Fix Version/s: 6.0
    • Component/s: Rules
    • Labels:
      None

      Description

      unsigned int bigUValue = 4'294'967'295;
      void testFP() {
        if (bigUValue > -5) { // -5 is implicitly converted to 4294967291U
          // this is true
        }
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              massimo.paladin Massimo PALADIN
              Reporter:
              massimo.paladin Massimo PALADIN
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: