------- Comment #7 from maurice35 dot david at laposte dot net 2009-10-21 09:37 ------- It seems that I have a similar issue with ccmips compilator : typedef struct { char A; char B; char C; /*char padding;*/ } tStructABC;
typedef struct { tStructABC ABC1; tStructABC ABC2; } tStruct2ABC; tStruct2ABC Struct2ABC; int Compute(tStructABC ArgA,tStructABC ArgB) { return(ArgA.A+ArgA.B); } int main(int argc, char *argv[]) { tStructABC * pABC1; tStructABC * pABC2; pABC1 = &(Struct2ABC.ABC1); pABC2 = &(Struct2ABC.ABC2); printf("Compute=%d\n",Compute(*pABC1,*pABC2)); } This code crash with the printout: Address load Exception Exception Program Counter: 0x803f56f8 Status Register: 0x3000ff01 Cause Register: 0x00000010 Access Address : 0x80b8da83 Task: 0x80ffa440 "PGL_Main" 0x80ffa440 (PGL_Main): task 0x80ffa440 has had a failure and has been stopped. 0x80ffa440 (PGL_Main): fatal kernel task-level exception! So The crash is due to an alignment issue on the address &(Struct2ABC.ABC2);. To avoid this issue we need to add a padding byte in tStructABC because it seems that there is no way to force a padding through a compilation option or through a #pragma (as example #pragma pack(4)). Please could you confirm this issue in compilation sw (ccmips) or not. see: Created an attachment (id=18854) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18854&action=view) [edit] Screen shoot form lauterbach Best regard, -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37954