Parasoft Static Analysis says:
Not all elements of variable ‘array_a’ are initialized.
This is not correct. All elements are initialized and the code does not violate MISRA-C 9.2, which explicitly allows zero initialization with just one item of the array set to zero.
static float array_b[20] = {0};
Strictly speaking this is not MISRA compliant, since all integer literals have to be unsigned as they were in your first code. Change to 0u
or 0U
or indeed 0.0f
(the latter makes most sense).
static unsigned int array_a[30] = {0};
Same here, not MISRA compliant.
The Parasoft Static Analysis is not showing any issues for line 4 above.
It would appear that Parasoft is incorrect in all the mentioned cases. You should report this as bugs in their MISRA checker.
IAR appears to be correct in all the mentioned cases.