Menu

MISRAC2012-RULE_10_4 - False positive

spoorcc
2023-06-06
2023-06-15
  • spoorcc

    spoorcc - 2023-06-06

    Hi All,

    Here a false positive in cppcheck 2.10 misra.py addon which is related to #10499 which was fixed in https://github.com/danmar/cppcheck/commit/3c1ae779628964735bf18b6c70f317825a8d470f

    In this case however the array is inside a struct:

    typedef struct
    {
        char data[24]; 
    } MyStruct_t;
    
    void UsingStruct(void);
    void UsingStruct(void)
    {
        static MyStruct_t s_myStruct;
    
        if (s_myStruct.data[0] == '\0') /* false positive: [misra-c2012-10.4] */
        {
            ;
        }
    }
    
     
  • Daniel Marjamäki

    Thanks for reporting!

    I have created https://trac.cppcheck.net/ticket/11756

     
  • spoorcc

    spoorcc - 2023-06-15
     

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.