This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Error not caught by MSP430 C compiler and/or MISRA

I am using CCS v5.1 and MSP430 C Compiler v4.0.0.  The following code shows two type checking errors:  one that the compiler (with MISRA checks turned on) catches and another that the compiler does not catch.  The missed error appears to be related to the indexed array not preserving the user-defined type.  I believe I have seen similar errors when referencing members of structs.

Perhaps my MISRA understanding is incorrect, but if the one statement is flagged as an error, I would assume the other should be flagged as well.

Thanks, Austin

 

typedef enum SpiRfError
{
    SpiRfError_OK,
    SpiRfError_NO_DATA,
    SpiRfError_BUFFER_FULL
} SpiRfError_t;

const SpiRfError_t _errors[2] = {SpiRfError_OK, SpiRfError_OK};

uint16_t _Func(void)
{
    uint16_t myError;

    myError = SpiRfError_OK;    /* correctly flags as error (MISRA 10.1) */

    myError = _errors[0];       /* does not find error */

    return myError;
}