public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "maurice35 dot david at laposte dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/37954] odd sized packed structures passed by value, under ARM, cause lockup of application
Date: Wed, 21 Oct 2009 09:37:00 -0000	[thread overview]
Message-ID: <20091021093725.23851.qmail@sourceware.org> (raw)
In-Reply-To: <bug-37954-16876@http.gcc.gnu.org/bugzilla/>



------- 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


  parent reply	other threads:[~2009-10-21  9:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29 19:43 [Bug c/37954] New: odd sized packed structures, " damon dot michaels at navico dot com
2008-10-29 19:44 ` [Bug c/37954] " pinskia at gcc dot gnu dot org
2008-10-29 19:49 ` damon dot michaels at navico dot com
2008-10-29 19:52 ` damon dot michaels at navico dot com
2008-10-29 19:53 ` damon dot michaels at navico dot com
2008-10-29 19:53 ` damon dot michaels at navico dot com
2009-10-21  9:36 ` [Bug target/37954] odd sized packed structures passed by value, " maurice35 dot david at laposte dot net
2009-10-21  9:37 ` maurice35 dot david at laposte dot net [this message]
2009-10-21 12:20 ` mikpe at it dot uu dot se
2009-10-21 14:47 ` maurice35 dot david at laposte dot net
2009-10-21 19:47 ` mikpe at it dot uu dot se
2009-10-22 17:55 ` mikpe at it dot uu dot se
2009-10-23  0:29 ` mikpe at it dot uu dot se
2009-10-23 12:49 ` mikpe at it dot uu dot se
2010-09-01 12:41 ` [Bug target/37954] [4.3 only] " ramana at gcc dot gnu dot org
     [not found] <bug-37954-4@http.gcc.gnu.org/bugzilla/>
2011-04-28 16:25 ` [Bug target/37954] " rguenth at gcc dot gnu.org
2015-03-12 11:29 ` ramana at gcc dot gnu.org
2015-04-30 11:15 ` amodra at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091021093725.23851.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).