Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MyXZ7-0002S0-8d for qemu-devel@nongnu.org; Thu, 15 Oct 2009 17:08:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MyXZ5-0002Pe-Nb for qemu-devel@nongnu.org; Thu, 15 Oct 2009 17:08:52 -0400 Received: from [199.232.76.173] (port=52284 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MyXZ5-0002PS-Bg for qemu-devel@nongnu.org; Thu, 15 Oct 2009 17:08:51 -0400 Received: from hall.aurel32.net ([88.191.82.174]:33511) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MyXZ4-00048S-T1 for qemu-devel@nongnu.org; Thu, 15 Oct 2009 17:08:51 -0400 Received: from [2002:52e8:2fb:1:21e:8cff:feb0:693b] (helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1MyXZ3-0007NP-BC for qemu-devel@nongnu.org; Thu, 15 Oct 2009 23:08:49 +0200 Received: from aurel32 by volta.aurel32.net with local (Exim 4.69) (envelope-from ) id 1MyXZ0-0003HA-JG for qemu-devel@nongnu.org; Thu, 15 Oct 2009 23:08:46 +0200 Date: Thu, 15 Oct 2009 23:08:46 +0200 From: Aurelien Jarno Message-ID: <20091015210846.GB7071@volta.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Subject: [Qemu-devel] [PATCH] target-arm: fix sdiv helper List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org (INT32_MIN / -1) triggers an overflow, and the result depends on the host architecture (INT32_MIN on arm, -1 on ppc, SIGFPE on x86). Use a test to output the correct value. Signed-off-by: Aurelien Jarno --- target-arm/helper.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 701629a..b3d6198 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -404,6 +404,8 @@ int32_t HELPER(sdiv)(int32_t num, int32_t den) { if (den == 0) return 0; + if (num == INT_MIN && den == -1) + return INT_MIN; return num / den; } -- 1.6.1.3