From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3820FC0015E for ; Tue, 1 Aug 2023 19:54:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231151AbjHATya (ORCPT ); Tue, 1 Aug 2023 15:54:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229628AbjHATy3 (ORCPT ); Tue, 1 Aug 2023 15:54:29 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EDBEE67; Tue, 1 Aug 2023 12:54:28 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id C520B5C0182; Tue, 1 Aug 2023 15:54:27 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Tue, 01 Aug 2023 15:54:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1690919667; x=1691006067; bh=2M n6OlH+kFijO/OSJ+b/5cNGvEQaHJDvRBONu3It1/A=; b=X7jfWhTFQxa5lSdG95 SsWWLexeFFtQc95pZEWp6EAdfSTXI/gQXdthLOJUWvH+vZ8bf7EX+IcYCviT7+79 pSNHWiMKQSaSdF7xUioTGQ2thWV4URCokLk5Linfp3fQooybJsFfB+g36IURnvPl iZPCphWffMNNqFKN/hd10P4Sjdfcu6QlMnIm0mvWKYOdqsy0oemNAdGAkhdD7Cvp BKXrZtdUWt7eGOPYJhDMeGJv0kYGl4t5DvprPlfaox0mYaP6f9z9EV5SmkHP20sE d7ZtUG2XMY7p2cbqN8sTVceDUDOsag+JboAN7FVQszRotWfkVoRFdAO3ZZqBINIc kabA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1690919667; x=1691006067; bh=2Mn6OlH+kFijO /OSJ+b/5cNGvEQaHJDvRBONu3It1/A=; b=3OwLcOUZllw6Sbjm9UT2+gmZhibYm pprBGPfmlk/2cEPQNOjT5Q6ufnY3zsf7zBj+aCJvjbbEyL8pwHJUSX/581DphrYe e0bGfTvhKTJPyPuqtQm/Pk63BP9WjarjECFE4nw9D98ZMJyF3p3Kb3JvVOzhOQ9P +mqOWiL2gHZkdUcSaeiFvCa15yDfwmtTDYV5SjGilQ4+RI2SJOk7uYikV11WJ/Pi ASMNlbGCtFZzDj2yocLspiT/vHb+9rKZaF+WlMmQf+l99mf2+l6UZ7qYZ8Q3nafO URs/eYx7jxm2uOT3UO/sg4ILi5XxPBE3TAVfBwRcPj46g9JFDYxA7zPnw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrjeeigddufeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 607BCB60089; Tue, 1 Aug 2023 15:54:27 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-592-ga9d4a09b4b-fm-defalarms-20230725.001-ga9d4a09b Mime-Version: 1.0 Message-Id: <1f7e045a-5dc1-4667-b09d-bc74953e48b0@app.fastmail.com> In-Reply-To: <67f2a68f-8462-e1de-c016-b84d7c6e3222@acm.org> References: <227327a3-399a-4a9f-a775-e9627656b5a1@app.fastmail.com> <67f2a68f-8462-e1de-c016-b84d7c6e3222@acm.org> Date: Tue, 01 Aug 2023 21:54:06 +0200 From: "Arnd Bergmann" To: "Bart Van Assche" , "Naresh Kamboju" Cc: "open list" , linux-scsi@vger.kernel.org, linux-next , "Avri Altman" , "Martin K. Petersen" , "Anders Roxell" Subject: Re: next: arm64: gcc-8-defconfig: ufshcd.c:10629:2: /builds/linux/include/linux/compiler_types.h:397:38: error: call to '__compiletime_assert_553' declared with attribute error: BUILD_BUG_ON failed: Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-next@vger.kernel.org On Tue, Aug 1, 2023, at 19:51, Bart Van Assche wrote: > On 8/1/23 07:56, Arnd Bergmann wrote: >> On Tue, Aug 1, 2023, at 16:23, Naresh Kamboju wrote: > > If I change the return type of ufshcd_check_header_layout() from void > into unsigned int and insert the following at the start of that function: > > return ((u8 *)&(struct request_desc_header){ .enable_crypto = 1})[2] != 0x80; > > then the compiler shows the following in the output window: > > xorl %eax, %eax > > In other words, the expression next to the return statement evaluates to zero > but the same expression does not evaluate to zero in the BUILD_BUG_ON() > statement. Does this perhaps indicate a compiler bug? And if so, what is the > appropriate way to fix the build error? Insert an #ifdef/#endif pair inside > ufshcd_check_header_layout() such that the compile-time checks do not happen > for gcc version 9 or older? I played around it some more, and this apparently comes down to constant-folding in sub-byte bitfields, so in the older compilers neither the ==0x80 nor the !=0x80 case can be ruled out because of a missing optimization. Instead the generated code would try to initialize the variable at runtime and then do a conditional branch to the assert, but that of course fails the build. I'd suggest something like if (defined(GCC_VERSION) && GCC_VERSION < 100000) return; before the assertion, in that case it doesn't evaluate it. Arnd