Description
Warning: [214-228] Alignment is
insufficient (align=
Alignment
, required=RequiredAlignment
) on Name
DebugLoc).- Alignment
- Unsigned number
- RequiredAlignment
- Unsigned number
- Name
- Name of array
Explanation
Consider the packedness and byte alignment of user-defined structures in the interface. This message reports the bursting algorithm has determined that the given user-defined type has insufficient alignment. Identify the correct byte alignment of the user-defined type and specify it via attributes in the source code.
Example
//////////// ORIGINAL ////////////
struct mystruct {
char a;
short b;
};
void foo(mystruct *a, mystruct *b) {
for( int i = 0; i < 256; ++i )
b[i] = a[i];
}
//////////// UPDATED ////////////
struct mystruct {
char a;
short b;
} __attribute__((packed, aligned(4)));
void foo(mystruct *a, mystruct *b) {
for( int i = 0; i < 256; ++i )
b[i] = a[i];
}