Menu

false positive (if - else)

2017-06-13
2020-01-04
  • Stefano Bordoni

    Stefano Bordoni - 2017-06-13

    Using v1.79, I found a false positive.

    It is triggered by something like this small .c

    test.c

    int GetVal (void)
    {
    return 0x123548;
    }

    int * GetPtr (int *pPtr)
    {
    return pPtr;
    }

    int main (void)
    {
    int x, *pPtr;

    x = GetVal ();
    if (pPtr = GetPtr (&x), pPtr == NULL)
        x = 0x01;
    else
    {
        x = *pPtr;
    }
    return x;
    

    }


    Best Regards

    Stefano

     
  • Daniel Marjamäki

    Thanks! I can reproduce. I created http://trac.cppcheck.net/ticket/8105.

     
  • Ken-Patrick Lehrmann

    Looks like this has been fixed with 597d0fa35b7d752677394df85d06b3458c8e30b4

    Btw, could you create me a trac account ?

     
  • Daniel Marjamäki

    Sure. Please generate a htpasswd hash and send that to me. You can generate the htpasswd hash on your computer if you want. Or online (google "htpasswd generator").

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.