The mandatory rule 13.6 of the MISRA-C:2012 should be supported:
The operand of the sizeof operator shall not contain any expression which has potential side effects
Example 1:
volatile int32_t i;
int32_t j;
size_t s;
s = sizeof ( j ); /* Compliant /
s = sizeof ( j++ ); / Non-compliant /
s = sizeof ( i ); / Compliant - exception /
s = sizeof ( int32_t ); / Compliant */
Example 2:
volatile uint32_t v;
void f ( int32_t n )
{
size_t s;
s = sizeof ( int32_t[ n ] ); /* Compliant /
s = sizeof ( int32_t[ n++ ] ); / Non-compliant */
s = sizeof ( void ( [ n ] ) ( int32_t a[ v ] ) ); / Non-compliant */
}