From patchwork Fri Mar 27 09:49:43 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: 185002 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp1099946ilr; Fri, 27 Mar 2020 02:54:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvqYXgOon9CPjq2nAOkGkOMfBqD6Uy1rHr0+Bw2VQjhL2yoAXoGMvyhEa9srkNqSPNyfKIe X-Received: by 2002:a37:6606:: with SMTP id a6mr12697642qkc.364.1585302843260; Fri, 27 Mar 2020 02:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585302843; cv=none; d=google.com; s=arc-20160816; b=oxDfZyhelnrB8y90WPDVxuD6zzlkYpvJmtEOzmxiZVmX4bte8cp2rwRPnhq+UVYn+J L2GYQe1ouSGdfRAY3RpiQ88pEpaPXY4NGb9jR279tSrcWrtHKQXHSWQCROeByFiYB3wb 8Toge8KMqhzLyQ3va+VxZCj8wR+CdT2E8MCBqAn8U8O2yBGwN2ZOgP9uyptmtBP+FovR NmDHBs9feXrPDL58YtcBEBH5U/72aHfVyZzbRCGEPszoANA4cVJ3aYL9sdvRL+StK0r9 Uo6B/cSq8FXlzC7uE9/l57RY5gQaU6Z9BH6Lss5nSxtzSqQSqC1uuyr/3I/WJfIHvgYm h4mw== 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=jNCqItbHzWYtJLgrz36pXVxvUTrH1kU9rm8Huuj6L8g=; b=YasdLUuogUC8GTYRZaORq0l4MIncUe/SbdQeIomhdPbHFxSx7kNENFK8V18eTAFEyd ZTNtcsUUOe8Rmb7PkEbCXleCgPw2YQlVBuXWSZIxFtUC9EygdGGNans3tFaKkflCyCow bnliJ9kHP1CZhYCn4Pf9abiovJVg2VORmKKuuFP7uOvDqqLl1eeVN/Z1YUaUySM8t/Vs MIzOus43fJIcyrKmo9sTHtIdFXe9nltoV8nQcz1DvccYWVq3hfdoSJtf6m8U75+rLt+L MyBFkMqTWf2i3McZdIjFKncTJqzQRXhWOhiX0KJnd9eOOpDG4tcVOUyBe2ywZcZHR8s6 uLBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CT2ZEuo6; 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 r10si2968723qtt.277.2020.03.27.02.54.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Mar 2020 02:54:03 -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=CT2ZEuo6; 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]:39312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHlgg-00036g-On for patch@linaro.org; Fri, 27 Mar 2020 05:54:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37935) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHlcg-0003VH-W6 for qemu-devel@nongnu.org; Fri, 27 Mar 2020 05:49:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHlcf-0003td-Vl for qemu-devel@nongnu.org; Fri, 27 Mar 2020 05:49:54 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:36541) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHlcf-0003sL-Pj for qemu-devel@nongnu.org; Fri, 27 Mar 2020 05:49:53 -0400 Received: by mail-wm1-x342.google.com with SMTP id g62so11620034wme.1 for ; Fri, 27 Mar 2020 02:49:53 -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=jNCqItbHzWYtJLgrz36pXVxvUTrH1kU9rm8Huuj6L8g=; b=CT2ZEuo6RoEOFsURF2XHIcP10MRlgxHe3GY3DaMvXth+dL1nI7B5O0AdnuFaAORhOB 77QULAsvYHNMd3IJDbLiXBdBRS/wzC0c5BDcpv0hz1zi6/u904+WGvdXvJpj50njI4Yr mfuIqR4WyR7zbvlv+kbIaKVhVKtCjxOZdbsWShGX9DjFEuTqgA5gQ0k19m9Z31xAw0A7 AqgWrPREKdy0bYkPK7ti4F+y4lAOYuwVeBLFoNF8VZUU6rT5CQLpkkzfON66g32nGfk/ tbyPgUa4evBMbRz37K6OSu2ilcykE1VzFHC3XKREB+8bFkgS/rCfqGRHqxmhNWuq3hbl hq0Q== 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=jNCqItbHzWYtJLgrz36pXVxvUTrH1kU9rm8Huuj6L8g=; b=Yfu9jaP3souiCHQHwJr80eHlqV6gErjdrxdh2lO+AzJ3RlUXOO2ulXofDNqVnb6Gis 865FIRNFYalwiNevT9FwXQCuBJqlJ+s3lpDVS74AnKR1H0YwuQ0yotmr4hTVkTaHqWVQ xz29uew+Vmrlb45lTC81Lj1msIceb0yH7JTadhDAtwaPjrpfp4gt5MpaB0YWlJBRj9go 4bXhvIt4ANX2HdYWX4t7V6araAWzN1A016FnwxnA0wNpeE+KpBqhq+J/QOGLnD2d6zDc fkOSxRLGAkEMLC8vgAJTHZY2QB/+E8Rkegov0+Y4tfczgeHplFO/EYPlpO46M2CaAEyB v/9A== X-Gm-Message-State: ANhLgQ0SfC8NBSw2+NutIvKGlz3p2CP8uEgu6I6WT93/9a+Foj6iPLPh x+0AWRlk5II3mhzQbZq1/rxJzQ== X-Received: by 2002:a1c:9693:: with SMTP id y141mr4361799wmd.23.1585302592871; Fri, 27 Mar 2020 02:49:52 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id l12sm7561737wrt.73.2020.03.27.02.49.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 02:49:50 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D2D8D1FF91; Fri, 27 Mar 2020 09:49:45 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 5/7] fpu/softfloat: avoid undefined behaviour when normalising empty sigs Date: Fri, 27 Mar 2020 09:49:43 +0000 Message-Id: <20200327094945.23768-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200327094945.23768-1-alex.bennee@linaro.org> References: <20200327094945.23768-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::342 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: Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The undefined behaviour checker pointed out that a shift of 64 would lead to undefined behaviour. Signed-off-by: Alex Bennée --- fpu/softfloat.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 301ce3b537b..444d35920dd 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -3834,9 +3834,14 @@ void normalizeFloatx80Subnormal(uint64_t aSig, int32_t *zExpPtr, { int8_t shiftCount; - shiftCount = clz64(aSig); - *zSigPtr = aSig<