From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753690AbdGSMzY (ORCPT ); Wed, 19 Jul 2017 08:55:24 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:54098 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753401AbdGSMzU (ORCPT ); Wed, 19 Jul 2017 08:55:20 -0400 From: Arnd Bergmann To: x86@kernel.org, Bill Metzenthen , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Cc: linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 3/8] x86: math-emu: avoid bogus -Wint-in-bool-context warning Date: Wed, 19 Jul 2017 14:53:01 +0200 Message-Id: <20170719125310.2487451-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170719125310.2487451-1-arnd@arndb.de> References: <20170719125310.2487451-1-arnd@arndb.de> X-Provags-ID: V03:K0:IZpaFaGRSoXV4oAsBe6k68n9Q3IvjbkYIGzqdY2Lj2MgR6R2R/R /RyssTDz3yIbWcmG4zg+1MWaZap+ttZahpskhwV4O5gb6PzxCtDFtknVezj+S/6HZDQ6+qv 1EyPNWwYno8l9F5c9gmyCOTFV6KtD0Ym6FlQcfYBRJb2MnEyXrfe+mHLpA/SyhKxl72LLs4 dRz6yr5hiPL2hRw0FD9Mg== X-UI-Out-Filterresults: notjunk:1;V01:K0:eYMDD0vCATQ=:p+3QhEDng10pvMCFZiasAj tnUQk0XIWA1qZ6ikcZ9UxLl+G4jLGR74Mr5nZJsLK0euaTF/4UWNgtyRpse19QDlL1o7D07LX QSjAW55envFp7vw+OZFH9r36qSoSy4IO3hc2w9eAqmKC25X59Bqmu535MLD9lBdGyJqFutJqZ bPcR6oSt88dnjCshe2aQyIMwbTn/AGRdJ1mgamPlgP8w9c1rHsIFttBPxZsWPsN+K9hJYRRlP HKdAm0eMonafsoQayFh/QSvK7xl10lVRoZjhLJS33O4L3U13Mh+/1hNu4KcK+YzJ4GyBtGnXI eggBkMd+dGc8FFgutgKEQN3axCGBkeWYLq11Cj6yr8O1lO61wuqctIG241zlFzrrDE+TZzQjC 9CU5HSNwms4NDbgMaGdNXgrii41GSJhh1EDpG9gtrxW24SW6fD3modWp1yFpUJDfnuNRFjMqV 99aeIWoSyPqtdx8dzM4JC+S2MRNcmmupgvmbsp7yujxAbG5WvxrN1QGhcvTKf38x+EJI7MLby ThOJY8UP9SQJZzLVeIc1z/OyUi2VNpef0XJObg/nALwED0CSN/mA36u4+ZBYVm5elLhihrdfX 4GTk8e6aLFUB+FD/eYH+YGTjeOBfhv5CR54v+NG5ff8EuyOhqFE15/7zn9sHN6gw7B+1ET2gY N5CNfkRTFmnQPIoM4e0WL5JeWlCSGDoKgh7DDh11GUC4g46/KoqxHr+Z4HkSfGWhL9UavMnwL W6kOLwwMr43ccK8N6MSuJ41PteVgOE2qELczvQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc-7.1.1 produces this warning: arch/x86/math-emu/reg_add_sub.c: In function 'FPU_add': arch/x86/math-emu/reg_add_sub.c:80:48: error: ?: using integer constants in boolean context [-Werror=int-in-bool-context] This appears to be a bug in gcc-7.1.1, and I have reported it as PR81484. The compiler suggests that code written as if (a & b ? c : d) is usually incorrect and should have been if (a & (b ? c : d)) However, in this case, we correctly write if ((a & b) ? c : d) and should not get a warning for it. This adds a dirty workaround for the problem, adding a comparison with zero inside of the macro. The warning is currently disabled in the kernel, so we may decide not to apply the patch, and instead wait for future gcc releases to fix the problem. On the other hand, it seems to be the only instance of this particular problem. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81484 Signed-off-by: Arnd Bergmann --- Originally sent on July 14, this is the same patch again with an rewritten changelog. --- arch/x86/math-emu/fpu_emu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/math-emu/fpu_emu.h b/arch/x86/math-emu/fpu_emu.h index afbc4d805d66..c9c320dccca1 100644 --- a/arch/x86/math-emu/fpu_emu.h +++ b/arch/x86/math-emu/fpu_emu.h @@ -157,7 +157,7 @@ extern u_char const data_sizes_16[32]; #define signbyte(a) (((u_char *)(a))[9]) #define getsign(a) (signbyte(a) & 0x80) -#define setsign(a,b) { if (b) signbyte(a) |= 0x80; else signbyte(a) &= 0x7f; } +#define setsign(a,b) { if ((b) != 0) signbyte(a) |= 0x80; else signbyte(a) &= 0x7f; } #define copysign(a,b) { if (getsign(a)) signbyte(b) |= 0x80; \ else signbyte(b) &= 0x7f; } #define changesign(a) { signbyte(a) ^= 0x80; } -- 2.9.0