Hi,
I'm using TI ARM compiler v5.1.7. And I think that following case not violates MISRA rule 10.3 by casting uint32_t * to s2*. Or am I missing something?
typedef struct _s1{
uint32_t a;
uint32_t b;
}s1;
typedef struct _s2{
uint16_t d;
uint16_t e;
}s2;
void a(s1 *val);
void a(s1 *val)
{
s2 *tmp = (s2*)NULL;
tmp = (s2*)&(val->a);/** violates rule (MISRA-C:2004 10.3/R) The value of a complex expression of integer type shall only be cast to a type of the same signedness that is no wider than the underlying type of the expression */
tmp->d = 0U;
}
Luděk Hezina