I\'m reading paragraph 7 of 6.5 in ISO/IEC 9899:TC2.
It condones lvalue access to an object through:
an aggregate or union type that includes
I think this text does not apply:
an aggregate or union type that includes one of the aforementioned types among its members (including, recursively, a member of a subaggregate or contained union),
sp->x
has type unsigned int
which is not an aggregate or union type.
In your code there is no strict aliasing violation: it is OK to read unsigned int
as unsigned int
.
The struct might have different alignment requirements to the array but other than that there is no problem.
Accessing via "an aggregate or union type" would be:
s t = *sp;