From patchwork Mon Oct 10 22:16:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 680578 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3stDxp6MHDz9sBR for ; Tue, 11 Oct 2016 09:17:02 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=i75BIMVS; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:message-id:to:subject; q=dns; s= default; b=nF09jyeJihZ/lA5RMKyLbqJsKbKQl+oH9kHucBq6/P/zK9XQuraoX i2CJUlkAtIychYWzMJYxF/WuRv379EY94tYv8t2MxoLt5z/coOXM5JKfGjYk2MbP Tj1LYYKgYWd3uY3lb7k9Jgq4J1B62ZH/6ioKYoWweZtwQ1kyn+wp+0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:message-id:to:subject; s=default; bh=Cz2bVUR2MaKaUwJJq3X00WbbWL4=; b=i75BIMVS3tXtB/nwNNZiPC97Qd0P vXzFu3YtEWzNHsZALo88uFaHbx6HvyGIxBMJ6rg/MhdNmfga2mMbfZbZEKoeYdeB FyUkIezc9Pik94Zpcs7nS7aIL34E63VEDQlnf9rALNGjJeK2b/Xt7Cx2PKw081I7 m0I8wqywYd6c+fg= Received: (qmail 116758 invoked by alias); 10 Oct 2016 22:16:57 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 116743 invoked by uid 89); 10 Oct 2016 22:16:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM, RCVD_IN_XBL autolearn=no version=3.3.2 spammy=sysdeps, easiest, steve, Hx-languages-length:1824 X-HELO: sellcey-thinkpad.caveonetworks.com Date: Mon, 10 Oct 2016 15:16:43 -0700 From: Steve Ellcey Message-Id: <201610102216.u9AMGhpL024615@sellcey-thinkpad.caveonetworks.com> To: libc-alpha@sourceware.org Subject: [PATCH] Fix warnings from latest GCC I was building the top-of-tree glibc with the top-of-tree GCC and ran into some new GCC errors. ../sysdeps/ieee754/dbl-64/e_pow.c: In function ‘checkint’: ../sysdeps/ieee754/dbl-64/e_pow.c:469:13: error: << in boolean context, did you mean '<' ? [-Werror=int-in-bool-context] if (n << (k - 20)) ~~^~~~~~~~~~~ ../sysdeps/ieee754/dbl-64/e_pow.c:471:17: error: << in boolean context, did you mean '<' ? [-Werror=int-in-bool-context] return (n << (k - 21)) ? -1 : 1; ~~~^~~~~~~~~~~~ ../sysdeps/ieee754/dbl-64/e_pow.c:477:9: error: << in boolean context, did you mean '<' ? [-Werror=int-in-bool-context] if (m << (k + 12)) ~~^~~~~~~~~~~ ../sysdeps/ieee754/dbl-64/e_pow.c:479:13: error: << in boolean context, did you mean '<' ? [-Werror=int-in-bool-context] return (m << (k + 11)) ? -1 : 1; ~~~^~~~~~~~~~~~ cc1: all warnings being treated as errors The easiest fix seems to be to add explicit '!= 0' to these lines. I did this and verified that the generated code (on aarch64) is identical. OK to checkin? Steve Ellcey sellcey@caviumnetworks.com (previously sellcey@imgtec.com) * e_pow.c (checkint) Make conditions explicitly boolean. diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c index 663fa39..bd758b5 100644 --- a/sysdeps/ieee754/dbl-64/e_pow.c +++ b/sysdeps/ieee754/dbl-64/e_pow.c @@ -466,15 +466,15 @@ checkint (double x) return (n & 1) ? -1 : 1; /* odd or even */ if (k > 20) { - if (n << (k - 20)) + if (n << (k - 20) != 0) return 0; /* if not integer */ - return (n << (k - 21)) ? -1 : 1; + return (n << (k - 21) != 0) ? -1 : 1; } if (n) return 0; /*if not integer */ if (k == 20) return (m & 1) ? -1 : 1; - if (m << (k + 12)) + if (m << (k + 12) != 0) return 0; - return (m << (k + 11)) ? -1 : 1; + return (m << (k + 11) != 0) ? -1 : 1; }