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.

MISRA warning (MISRA-C:2004 12.8/R) Misreported

MISRA warning (MISRA-C:2004 12.8/R) The right-hand operand of a shift operator shall lie between zero and one less than the width in bits of the underlying type of the left-hand operand

In the following code I get MISRA 12.8 warning on myVar = myStruct.aVar >> 16 shift. Note that shift of unstructured variable myVar = myVar >> 16 is okay.

    typedef struct
    {
        unsigned long aVar;
    } myStruct_T;
 
    myStruct_T myStruct = {0xFFFFFFFFUL};
    unsigned long myVar;
   
    myVar = myStruct.aVar >> 16;
    myVar = myVar >> 16;

This problem has already been reported to TI but not via forum. I raise it here as it is not visible in the SDOWP.

Regards, Tony.