Menu

uninitvar false positive

jacob s
2021-02-02
2021-02-03
  • jacob s

    jacob s - 2021-02-02
    static int func()
    {
        int total_received = 0;
        int ret;
    
        do {
            if (req) {
                ret = total_received;
                break;
            }
    
        } while (true);
    
        return ret;
    }
    

    gives

    error: Uninitialized variable: ret [uninitvar]
    

    version 2.3

     
  • CHR

    CHR - 2021-02-03

    Thanks, this reproduces for me. Ticket is here: https://trac.cppcheck.net/ticket/10166

     

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.