Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936276AbdGTK3H (ORCPT ); Thu, 20 Jul 2017 06:29:07 -0400 Received: from terminus.zytor.com ([65.50.211.136]:46277 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935135AbdGTK3F (ORCPT ); Thu, 20 Jul 2017 06:29:05 -0400 Date: Thu, 20 Jul 2017 03:25:30 -0700 From: tip-bot for Arnd Bergmann Message-ID: Cc: arnd@arndb.de, hpa@zytor.com, torvalds@linux-foundation.org, mingo@kernel.org, billm@melbpc.org.au, linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de Reply-To: peterz@infradead.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, billm@melbpc.org.au, mingo@kernel.org, hpa@zytor.com, torvalds@linux-foundation.org, arnd@arndb.de In-Reply-To: <20170719125310.2487451-4-arnd@arndb.de> References: <20170719125310.2487451-4-arnd@arndb.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/fpu/math-emu: Avoid bogus -Wint-in-bool-context warning Git-Commit-ID: 5623452a0eaec1d44cc9f0770444a48847c9953f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2349 Lines: 60 Commit-ID: 5623452a0eaec1d44cc9f0770444a48847c9953f Gitweb: http://git.kernel.org/tip/5623452a0eaec1d44cc9f0770444a48847c9953f Author: Arnd Bergmann AuthorDate: Wed, 19 Jul 2017 14:53:01 +0200 Committer: Ingo Molnar CommitDate: Thu, 20 Jul 2017 10:46:24 +0200 x86/fpu/math-emu: Avoid bogus -Wint-in-bool-context warning 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. Signed-off-by: Arnd Bergmann Cc: Bill Metzenthen Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20170719125310.2487451-4-arnd@arndb.de Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81484 Signed-off-by: Ingo Molnar --- 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 afbc4d8..c9c320d 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; }