From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23881 invoked by alias); 21 Oct 2009 09:37:35 -0000 Received: (qmail 23852 invoked by uid 48); 21 Oct 2009 09:37:25 -0000 Date: Wed, 21 Oct 2009 09:37:00 -0000 Message-ID: <20091021093725.23851.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/37954] odd sized packed structures passed by value, under ARM, cause lockup of application In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "maurice35 dot david at laposte dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-10/txt/msg01810.txt.bz2 ------- 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