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.

CCS, MISRA Pointers, 10.3, MSP430



I am trying to assign the address of an unsigned integer to a pointer but cannot get rid of a MISRA 10.3 or 10.1 warning:

uint16_t Search_Key = 200U;

uint16_t *ptrSearch_Key;

ptrSearch_Key = (uint16_t *) (&Search_Key);   /* MISRA 10.3 error */

ptrSearch_Key = &Search_Key;                          /* MISRA 10.1 error */

I found a similar posr here for another processor:

e2e.ti.com/.../430393

Am I seeing a bug or a genuine error in my code?

Thanks, Nick.

  • The other forum thread you found exactly explains your situation.  I filed SDSCM00052021 in the SDOWP system to have this investigated.  If a way to avoid the MISRA diagnostic is possible, it will be given as part of that investigation.  Otherwise, it is called a compiler bug and fixed.

    Thanks and regards,

    -George