From patchwork Wed Apr 1 09:47:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185137 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp329883ilr; Wed, 1 Apr 2020 02:49:54 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtN+ladMtjbvsB0qogLcO5S2JX/pQxK6J/R6r2iLLa+iAkkevaE2vtgN5MZgR2xFKEhwoA9 X-Received: by 2002:aed:2822:: with SMTP id r31mr9225382qtd.87.1585734594586; Wed, 01 Apr 2020 02:49:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585734594; cv=none; d=google.com; s=arc-20160816; b=jcd4gVIa7fSkHAFahqjd2Iclk+JZBAX1pqghVEpQeLBLHK5Ngp7mtBnAZxme1TCjfO wmeWVpb+/m6kNjdTJjK43bmPEOZfBtpjEAp9dqunOSo2BT7wsHG/CTz4W/xO4TjQ9kG7 whIU6twHd4yL4/tTNrflp3AG91NN/iKRHnNFqBi7e56Fr+b9pOr/bYux6+OJu5g5fJI0 WNCVEv0bzTKd3hNUw8iz14dd5mnj02WUQ93dqTS0d4AwAUW4WRp9x0OqxPjQMY/RmExJ 9NZToXTWr1ukOnMDOZE5TswB+ZEK0SfnkeChf9eWiQ9lJ3Ot+s8Eai+T92IDOm+wvPKu M5eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=g9xr3EL2jz3uIXqebGO8vaQXLJoFQmUrqrOGsA7SE/w=; b=U41D0pZKdG/5Kmn/2wtxxJKi9pATIJD4aLcOngRJwiGEBV4/AbCJk9z01kvXUW7Y1Q Ae0Kcz8QGMiBqCq4Tile0YXkSP+MEQ0uhsV9S7HwMHQD4fBfpG/6m8SuEy/2ygX8dVwA j1EgiWUGF5tjrt4i+4PZnnNpLy5co2gnnPbHldsT8EpMBEIlGEDasducV2dx6NjT7QaA E0rqfUJMrjbupgGFBenlArWAiwfYkPXYAr1K/NU8c6K50YOq1Y3Oh4rVxbdvgSWkXhwz ujEcG+v67okeMWq+5XU45HKO62tkyp6jm9Ywtuh/iYX3KlskS9BrP+eQWBoRnaQHK3TI CZ/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jQAatAea; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o8si757843qvu.87.2020.04.01.02.49.54 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Apr 2020 02:49:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jQAatAea; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJa0Q-0007t1-1l for patch@linaro.org; Wed, 01 Apr 2020 05:49:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38473) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJZyn-0004Of-Ew for qemu-devel@nongnu.org; Wed, 01 Apr 2020 05:48:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJZym-0002Dj-6e for qemu-devel@nongnu.org; Wed, 01 Apr 2020 05:48:13 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:42120) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jJZym-0002Ci-0m for qemu-devel@nongnu.org; Wed, 01 Apr 2020 05:48:12 -0400 Received: by mail-wr1-x444.google.com with SMTP id h15so29711519wrx.9 for ; Wed, 01 Apr 2020 02:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g9xr3EL2jz3uIXqebGO8vaQXLJoFQmUrqrOGsA7SE/w=; b=jQAatAearxd3EEiqn5tSEB6+FPS2h3k2Td14CANfqmoJCDJfGpFBHjeY6zadkSv24h yOzZ+c4oPh3X7mEkfCn1TLTvqVi8LMAO+is7A/sV2hSz/E6I7CaU7oRQFgjjil0LdgiZ 2qwNUKn+0T+BxnJzheszEPcQLxXtYFhGbg9b/4h7EGsWqNryhmWWy0egpfn6c0HbPhJg f48+MdNSdYzfyYva/EklGDF/wx/edE196wks/6tT84kBC04HM55J1Zy0IjJSaxJXJ/dZ ocM6JskRmoB2jaw7XsvJkJgmPxtATA7+DDtpOKyykz3fMcNFL/j4Fn0WeZTaj0qjIEZm W8hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g9xr3EL2jz3uIXqebGO8vaQXLJoFQmUrqrOGsA7SE/w=; b=KxUFRKFvBcdOmdj6c8ZoeUNgWYUmypsDxjsZLScBtIBEFLD3HWU8noKWaFRMRJWyPY OVz3mkbVZWhQgy8uHsA50hE1mzf9FICJpQqfRap+SbcqYrUU8doGu0rjcBay10oGSOOS MElNPXdUWTnQi3B3IVumF4oVmToy9uhMgerXLpXzsw8yx/R9ZI1PHVwAMhrKLDznsJ41 gvb6R1Gr1aRAp/70FfAaSfWqI90IKOa0dDNV1pXTdyYTDh51qedtlb6BuiGtGyVnMIdi lryD6O60xv3i0IGzHyeJXJCqy8HpdfZ3jGCXIiUEOhy2mWupsvZpTLvh1aiT3ZN/cvW5 vZBQ== X-Gm-Message-State: ANhLgQ3XzRBVi+Hna/PMAFecqeV3SFPqA3ihC/tqoymVSEDI7HWCw/Ab MRyBCJy9im16P+2U2Rt7K+pVag== X-Received: by 2002:a5d:61c4:: with SMTP id q4mr26662376wrv.363.1585734491059; Wed, 01 Apr 2020 02:48:11 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m8sm1906126wmc.28.2020.04.01.02.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 02:48:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 364971FF93; Wed, 1 Apr 2020 10:48:01 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 07/10] softfloat: Fix BAD_SHIFT from normalizeFloatx80Subnormal Date: Wed, 1 Apr 2020 10:47:56 +0100 Message-Id: <20200401094759.5835-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200401094759.5835-1-alex.bennee@linaro.org> References: <20200401094759.5835-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Aurelien Jarno , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson All other calls to normalize*Subnormal detect zero input before the call -- this is the only outlier. This case can happen with +0.0 + +0.0 = +0.0 or -0.0 + -0.0 = -0.0, so return a zero of the correct sign. Reported-by: Coverity (CID 1421991) Signed-off-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20200327232042.10008-1-richard.henderson@linaro.org> --- fpu/softfloat.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 301ce3b537b..ae6ba718540 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -5856,6 +5856,9 @@ static floatx80 addFloatx80Sigs(floatx80 a, floatx80 b, flag zSign, zSig1 = 0; zSig0 = aSig + bSig; if ( aExp == 0 ) { + if (zSig0 == 0) { + return packFloatx80(zSign, 0, 0); + } normalizeFloatx80Subnormal( zSig0, &zExp, &zSig0 ); goto roundAndPack; }