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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E3082C04FF7 for ; Wed, 20 Sep 2023 20:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ozlabs.org; s=201707; t=1695240224; bh=t6K/84xLDF3EMRdQr7xNfy7OwgVBXNRp/r+q++QAGKc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=f+M5ti/8a9RbBLV+YB1wYwilm4zgEXxU+Qmepb7gw1Ieu5srNfDYvbF68bAWHzb8+ Tsq+8ooPaYwVF43kgUY0kTO3BoR6zVlSNcCLdBy/U4MQwUNtxnrIRFZHkTASNZEQgG T49902U4kOLYymqm4UNKPzp1VXdHpbisaW9MNNKd1yZ/nHXeJSzs5oQBeodpKgjdwS bulBnc8FeqzC92KzaFqslS+PpVjSDsTs5bDyT3WlKsDuHwzHrbWRvDPLfIlYtnfzA2 U8lv1ssSW662Cv5F9wiKGJenWvotKOWxuBtfGztyn9T9Wa87IZh6rFI2r/ES/nZo5W Vv2FU9Ikplo5w== Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4RrTxX2RBLz3cCC for ; Thu, 21 Sep 2023 06:03:44 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=145.40.73.55; helo=sin.source.kernel.org; envelope-from=srs0=qdox=fe=aol.com=hsiangkao@kernel.org; receiver=lists.ozlabs.org) Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4RrTxL5xV3z3bw9 for ; Thu, 21 Sep 2023 06:03:34 +1000 (AEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id AF10CCE1AE0; Wed, 20 Sep 2023 20:03:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A1ECC433C7; Wed, 20 Sep 2023 20:03:25 +0000 (UTC) To: linux-erofs@lists.ozlabs.org Subject: [PATCH] erofs-utils: fix build error when `-Waddress-of-temporary` is on Date: Thu, 21 Sep 2023 04:03:13 +0800 Message-Id: <20230920200314.9193-1-hsiangkao@aol.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Gao Xiang via Linux-erofs Reply-To: Gao Xiang Cc: Kelvin Zhang Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" From: Gao Xiang Actually, it's false positive and only used for build assertion. Reported-by: Kelvin Zhang Signed-off-by: Gao Xiang --- include/erofs_fs.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/erofs_fs.h b/include/erofs_fs.h index bdc946ac0c78..eba6c26d0253 100644 --- a/include/erofs_fs.h +++ b/include/erofs_fs.h @@ -440,10 +440,12 @@ struct z_erofs_lcluster_index { /* check the EROFS on-disk layout strictly at compile time */ static inline void erofs_check_ondisk_layout_definitions(void) { - const __le64 fmh __maybe_unused = - *(__le64 *)&(struct z_erofs_map_header) { - .h_clusterbits = 1 << Z_EROFS_FRAGMENT_INODE_BIT - }; + const union { + struct z_erofs_map_header h; + __le64 v; + } fmh __maybe_unused = { + .h.h_clusterbits = 1 << Z_EROFS_FRAGMENT_INODE_BIT, + }; BUILD_BUG_ON(sizeof(struct erofs_super_block) != 128); BUILD_BUG_ON(sizeof(struct erofs_inode_compact) != 32); @@ -463,8 +465,8 @@ static inline void erofs_check_ondisk_layout_definitions(void) BUILD_BUG_ON(BIT(Z_EROFS_LI_LCLUSTER_TYPE_BITS) < Z_EROFS_LCLUSTER_TYPE_MAX - 1); /* exclude old compiler versions like gcc 7.5.0 */ - BUILD_BUG_ON(__builtin_constant_p(fmh) ? - fmh != cpu_to_le64(1ULL << 63) : 0); + BUILD_BUG_ON(__builtin_constant_p(fmh.v) ? + fmh.v != cpu_to_le64(1ULL << 63) : 0); } #endif -- 2.30.2