Forum Discussion
Altera_Forum
Honored Contributor
15 years agoGCC generate the code to do multiple bus cycles to access misaligned data for members of 'packed' structures and structure members with alignment constraint, however it won't let you define a 'pointer to packed int'.
The following does work (retyped):typedef struct { int v; } __attribute__((packed)) packed_int;
struct foo {
char x;
packed_int y;
};
int bar(foo *z)
{
packed_int *p = &z->y;
return p->v;
}