From: Andrew STUBBS <andrew.stubbs@st.com>
To: GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH][SH] simulator mis-executing pre-decrement
Date: Fri, 02 Mar 2007 11:44:00 -0000 [thread overview]
Message-ID: <45E80DE2.1040708@st.com> (raw)
In-Reply-To: <45DF002F.2090403@st.com>
Ping. No word on this for a week.
Just in case everyone is waiting for the SH maintainer, there is no
specific maintainer for this simulator, so a global maintainer will be
required.
Thanks
Andrew STUBBS wrote:
> Hi,
>
> The attached patch fixes a problem with pre-decrement store instructions
> on the SH simulator.
>
> The problem can be demonstrated with the following program:
>
> #include <stdio.h>
>
> int
> main()
> {
> int i[2] = {0,0};
> int *p = &i[1];
>
> asm ("mov.l %0,@-%0\n" : "+r" (p));
>
> if ((int*)i[0] == &i[1])
> printf ("PASS: Value Correct.\n");
> else
> printf ("FAIL: Incorrect value written.\n");
>
> return 0;
> }
>
> The issue is that, when both operands use the same register, the *value*
> to be stored is decremented, but only the *address* of the store should
> have been decremented. I.e. in the example, it is supposed to store "p"
> at "p - 4", but actually stores "p - 4" at "p - 4".
>
> Note that GCC has a similar error which means that the two work together
> (probably not an accident), but the binaries may not work on real
> silicon. I think a patch for this problem will be submitted to GCC
> sometime soon.
>
> :ADDPATCH sh sim:
>
> Unfortunately, I can't test it on the latest GDB because CVS isn't
> accessible (corporate IT issue), but I'm fairly sure it works in the
> sources I do have. For the same reason, I'll have to ask somebody else
> to do the commit for me.
>
> Thanks
>
> Andrew Stubbs
>
next prev parent reply other threads:[~2007-03-02 11:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-23 14:55 Andrew STUBBS
2007-03-02 11:44 ` Andrew STUBBS [this message]
2007-03-02 12:00 ` Daniel Jacobowitz
2007-03-02 12:04 ` Andrew STUBBS
2007-03-02 12:15 ` Daniel Jacobowitz
2007-03-02 12:18 ` Andrew STUBBS
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=45E80DE2.1040708@st.com \
--to=andrew.stubbs@st.com \
--cc=gdb-patches@sourceware.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