Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4189003ybl; Tue, 20 Aug 2019 08:13:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRxQhGeEJffZ//Tw6We3YT6jalwejrrHZFLvFHl98fOnZVXWdzzIn47kMzYJ5pmYaHE5n2 X-Received: by 2002:aa7:8201:: with SMTP id k1mr29801482pfi.97.1566313998490; Tue, 20 Aug 2019 08:13:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566313998; cv=none; d=google.com; s=arc-20160816; b=BY09YZJQ1Ss8ixnhweEpqgV/F6RldVjMULfaYI3sGq0DxDgHQRthiPx/4T/sFBc96i LJDQ3Zxvrxb62we4BbzpdtvydN0JO80JEoFpsR5AMurHiCdMbqSUl8jwsZ3sgTwq9Sxu Feh297KNaYAn5xpgYbcVDTlZZrNXOGggHbNVgadWDNWeHRhI3kVYArR7P6G+38FQLaiT p96CnNoviogxYdMwTygz3AvkHzoAKIEvZ+jj/QoolR8fFVZgbPaZOpkfBpz7fdBqSvjd XRjQux/V2janKOz88MJasvtbTDtrPgLdCre9So1p6JX4vdb5OFjmhtAitToOmGyn+zb8 ewNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=IjcmPww+qgA4CVvye/OC2HMoJacAUPaybH8UKmMlftI=; b=D8AGoKnar26HI6UunzqX7aSBuFLZgReKGTe0Wk924crj0VbI/9HN2sTSNXMBE7CDkU PU4LTMw1bp5A9gZpVzdS/G0L85lM+X/jK7g1aHXFsHz/0ClLs2hEOUAdLp8GHGXDF5PK ms1FYCNJFyrg1RlhGqbTblPxfTYIlDnGp0bg4/KgRxyzOOOXpJJs5lC30lthh3D4Ftpp e6ylpOyqN6OGUuqt8K+ZqU7XXc2zOdXfSlnWslT1FKjyTpeQH2O7+Nc0/C9HFC/cIivd 4sEXHnivI1Xs14gZdncPxRbv0023vIx0hxbfPqhJ8vyMKPHbOPw8xEQpPqwYxigJ+mQD GGVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si170507pjs.13.2019.08.20.08.13.01; Tue, 20 Aug 2019 08:13:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730469AbfHTPLb (ORCPT + 99 others); Tue, 20 Aug 2019 11:11:31 -0400 Received: from www62.your-server.de ([213.133.104.62]:41682 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729847AbfHTPLa (ORCPT ); Tue, 20 Aug 2019 11:11:30 -0400 Received: from sslproxy05.your-server.de ([78.46.172.2]) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1i05nC-0000ZY-30; Tue, 20 Aug 2019 17:11:26 +0200 Received: from [178.197.249.40] (helo=pc-63.home) by sslproxy05.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1i05nB-000Sxp-QN; Tue, 20 Aug 2019 17:11:25 +0200 Subject: Re: [PATCH] test_bpf: Fix a new clang warning about xor-ing two numbers To: Nathan Chancellor , Alexei Starovoitov Cc: Martin KaFai Lau , Song Liu , Yonghong Song , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com References: <20190819043419.68223-1-natechancellor@gmail.com> From: Daniel Borkmann Message-ID: <636449fa-9bfb-2c1e-af20-2ddac83a2143@iogearbox.net> Date: Tue, 20 Aug 2019 17:11:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190819043419.68223-1-natechancellor@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.100.3/25547/Tue Aug 20 10:27:49 2019) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/19/19 6:34 AM, Nathan Chancellor wrote: > r369217 in clang added a new warning about potential misuse of the xor > operator as an exponentiation operator: > > ../lib/test_bpf.c:870:13: warning: result of '10 ^ 300' is 294; did you > mean '1e300'? [-Wxor-used-as-pow] > { { 4, 10 ^ 300 }, { 20, 10 ^ 300 } }, > ~~~^~~~~ > 1e300 > ../lib/test_bpf.c:870:13: note: replace expression with '0xA ^ 300' to > silence this warning > ../lib/test_bpf.c:870:31: warning: result of '10 ^ 300' is 294; did you > mean '1e300'? [-Wxor-used-as-pow] > { { 4, 10 ^ 300 }, { 20, 10 ^ 300 } }, > ~~~^~~~~ > 1e300 > ../lib/test_bpf.c:870:31: note: replace expression with '0xA ^ 300' to > silence this warning > > The commit link for this new warning has some good logic behind wanting > to add it but this instance appears to be a false positive. Adopt its > suggestion to silence the warning but not change the code. According to > the differential review link in the clang commit, GCC may eventually > adopt this warning as well. > > Link: https://github.com/ClangBuiltLinux/linux/issues/643 > Link: https://github.com/llvm/llvm-project/commit/920890e26812f808a74c60ebc14cc636dac661c1 > Signed-off-by: Nathan Chancellor Applied, thanks!