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 10.3 rule problem

Hello!


I've came accross a piece of code that fails on MISRA 10.3 rule. I'm suspecting a bug in the MISRA checker.


Example of function with MISRA 10.3 violation reported:

void Test1(const int16_t *test_in, int16_t *test_out, int16_t another_in)
{
    *test_out = (int16_t)(((int32_t)(*test_in) * (int32_t)another_in) / (int32_t)32768L); 
}

Example of code without warnings:

void Test2(int16_t test_in, int16_t *test_out, int16_t another_in)
{
    *test_out = (int16_t)(((int32_t)(test_in) * (int32_t)another_in) / (int32_t)32768L);
}


The only difference is, that one variable in a complex expression is passed by pointer. Compiler used is C2000 CGT 6.2.8. Is this a normal behaviour or am I missing something? Same error was reported on compiler version 6.2.1.


Best regards,

Jernej