From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16223 invoked by alias); 2 Mar 2007 11:44:11 -0000 Received: (qmail 16214 invoked by uid 22791); 2 Mar 2007 11:44:09 -0000 X-Spam-Check-By: sourceware.org Received: from lon-del-01.spheriq.net (HELO lon-del-01.spheriq.net) (195.46.50.97) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 02 Mar 2007 11:43:58 +0000 Received: from lon-out-02.spheriq.net ([195.46.50.130]) by lon-del-01.spheriq.net with ESMTP id l22BhZgN027477 for ; Fri, 2 Mar 2007 11:43:47 GMT Received: from lon-cus-01.spheriq.net (lon-cus-01.spheriq.net [195.46.50.37]) by lon-out-02.spheriq.net with ESMTP id l22BhY4u000631 for ; Fri, 2 Mar 2007 11:43:34 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-01.spheriq.net with ESMTP id l22BhXVV005181 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Fri, 2 Mar 2007 11:43:34 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 900C8DA41 for ; Fri, 2 Mar 2007 11:43:33 +0000 (GMT) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 40F7D4736E for ; Fri, 2 Mar 2007 11:43:33 +0000 (GMT) Received: from [164.129.15.13] (bri1043.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.7.5a-GA) with ESMTP id CIN85143 (AUTH stubbsa); Fri, 2 Mar 2007 11:43:31 GMT Message-ID: <45E80DE2.1040708@st.com> Date: Fri, 02 Mar 2007 11:44:00 -0000 From: Andrew STUBBS User-Agent: Thunderbird 2.0b2 (Windows/20070116) MIME-Version: 1.0 To: GDB Patches Subject: Re: [PATCH][SH] simulator mis-executing pre-decrement References: <45DF002F.2090403@st.com> In-Reply-To: <45DF002F.2090403@st.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00011.txt.bz2 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 > > 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 >