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.

C6000 cl6x 7.4.2: raises misra warnings 9.1 & 16.7 without a reason

both warnings are not hitting the point.

the 16.7 case probably has a problem detecting that a struct member in the array got assigned in the function.

then 9.1 case is up to discussion as the passed pointers are meant to only return some values by the function and not to pass values down to the function. a set of language keywords like _in, _out, _inout (does c++/c# have something?) would help resolving it at function prototype in implementation level rather than on invocation level.

C:\SW_TOOLS-trunk\compilers\c6000_7_4_2\bin\cl6x.exe file.c --check_misra=required,advisory,-1.1,-5.6,-6.3,-8.1,-17.4
"file.c", line 12: warning: (MISRA-C:2004 16.7/A) A pointer parameter in a function prototype should be declared as pointer to const if the pointer is not used to modify the addressed object ("a: const compound_t *")
"file.c", line 18: warning: (MISRA-C:2004 9.1/R) All automatic variables shall have been assigned a value before being used (variable "array")

file.c:

typedef struct
{
    int member;
} compound_t;

static void f(compound_t * a)
{
    a[0].member = 1;
    a[1].member = 1;
    a[2].member = 1;
    a[3].member = 1;
}

void a(void)
{
    compound_t  array[4];

    f (array);
}