From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: crossgcc@sourceware.org
Cc: Bob Dunlop <bob.dunlop@xyzzy.org.uk>, Richard Koch <n1gp@hotmail.com>
Subject: Re: Compiler Memory Alignment Issue
Date: Fri, 03 Feb 2012 13:21:00 -0000 [thread overview]
Message-ID: <201202031421.23553.yann.morin.1998@free.fr> (raw)
In-Reply-To: <20120203101627.GA13646@xyzzy.org.uk>
Richard, Bob, All,
On Friday 03 February 2012 11:16:27 Bob Dunlop wrote:
> On Thu, Feb 02 at 01:15, Richard Koch wrote:
> > I'm seeing an alignment issue when I'm incrementing a pointer.
I Just tried your .config and your sample C code, and it seems to work here
(with the buffer overflow fixed):
$ arm-none-linux-gnueabi-gcc -o ess ess.c
$ qemu-arm -L ..../arm-none-linux-gnueabi/sysroot ./ess
size of int is: 4
buffer[0]=ff
buffer[1]=ff
buffer[2]=ff
buffer[3]=ff
buffer[4]=34
buffer[5]=12
buffer[6]=0
buffer[7]=0
The assembly code corresponding to the assignment is (from gdb's disas /m):
14 *(ptr + 1) = 0x1234;
0x00008400 <+56>: ldr r3, [r11, #-16]
0x00008404 <+60>: add r2, r3, #4
0x00008408 <+64>: mov r3, #4608 ; 0x1200
0x0000840c <+68>: add r3, r3, #52 ; 0x34
0x00008410 <+72>: str r3, [r2]
As you can see for @0x8404, an offset of #4 is added to the address of the
array.
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software Designer | \ / CAMPAIGN | ^ |
| --==< O_o >==-- '------------.-------: X AGAINST | /e\ There is no |
| http://ymorin.is-a-geek.org/ | (*_*) | / \ HTML MAIL | """ conspiracy. |
'------------------------------'-------'------------------'--------------------'
--
For unsubscribe information see http://sourceware.org/lists.html#faq
next prev parent reply other threads:[~2012-02-03 13:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-02 18:15 Richard Koch
2012-02-02 23:09 ` Martin Guy
2012-02-02 23:26 ` Rod Nussbaumer
2012-02-03 9:52 ` Martin Guy
2012-02-03 10:16 ` Bob Dunlop
2012-02-03 13:21 ` Yann E. MORIN [this message]
2012-02-03 14:14 ` Johannes Stezenbach
2012-02-03 14:23 ` Yann E. MORIN
2012-02-03 20:41 ` Johannes Stezenbach
2012-02-03 15:13 ` Richard Koch
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=201202031421.23553.yann.morin.1998@free.fr \
--to=yann.morin.1998@free.fr \
--cc=bob.dunlop@xyzzy.org.uk \
--cc=crossgcc@sourceware.org \
--cc=n1gp@hotmail.com \
/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).