From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HUUMi-0002zw-88 for qemu-devel@nongnu.org; Thu, 22 Mar 2007 16:58:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HUUMg-0002vH-MZ for qemu-devel@nongnu.org; Thu, 22 Mar 2007 16:58:31 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HUUMg-0002un-IB for qemu-devel@nongnu.org; Thu, 22 Mar 2007 15:58:30 -0500 Received: from farad.aurel32.net ([82.232.2.251] helo=mail.aurel32.net) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HUUKq-0002eq-JB for qemu-devel@nongnu.org; Thu, 22 Mar 2007 16:56:36 -0400 Message-ID: <4602ED7D.2000503@aurel32.net> Date: Thu, 22 Mar 2007 21:56:29 +0100 From: Aurelien Jarno MIME-Version: 1.0 Subject: Re: [Qemu-devel] [SPARC] Branch condition problems References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org Blue Swirl a écrit : > Hi, > > I can't reproduce the problem with attached test program. Also the generated > ops look just fine: > [snip] > > Can you describe how to reproduce the bug? > Well I also have difficulties to reproduce it with a simple program. I have detected it while trying to build binutils on a Debian unstable distribution running in QEMU. The problem occurs when running the configure script of libiberty as a normal user using fakeroot, using bash as /bin/sh. The last character of some of the $LINENO variables is wrongly computed. It is computed using the modulo function from gcc (moddi3) called from fmtumax() called from itos(). In some very rare conditions (I don't know all of them) a branch is falsely taken which result in a wrong sign. When added to 0x30, it results in a wrong character. Some of them like ) or ( are triggering an error message. I have been able to track the bug up to the branch instruction followed by a std instruction by directly editing the assembly code of bash to cancel some tests. Note that you need to use fakeroot to see the problem, and also that using gdb workaround the bug. Rebuilding bash with -O0 or -O1 workarounds the problem. Using -g helps to get the function names along with the assembly code when using objdump To reproduce it, the best way is to use a Debian unstable distribution running in QEMU, at run (I can provide an image if you need one): apt-get install binutils cd binutils-2.17-3/libiberty fakeroot ./configure You will see that some tests fail with a strange error message from bash. This error is fixed by the patch I posted or by the one you posted. -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net