From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45ACB45B17; Fri, 11 Oct 2024 21:07:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C26C410E6; Fri, 11 Oct 2024 21:07:33 +0200 (CEST) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id A2C72410D5 for ; Fri, 11 Oct 2024 21:07:31 +0200 (CEST) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-20c693b68f5so24602575ad.1 for ; Fri, 11 Oct 2024 12:07:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728673651; x=1729278451; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=pPskpMoLRo5ggePJY11ysLV2Q07LApq3Krg9u+lzcgw=; b=KoDbiKSznBfG06q7WmKQhkQEwMnzRIWddocnoDIVf0wz5w9zbvGOG+ZBI3zvNSPaJq pYeE8m9ij3dQ3Uh6y8UnMAZ/81YvbxEiRmeDI/DCh6ZJoF2xGeppUNblPOItcgm2UKjm NujfYoEX4oE/BRWgg8GqHmgnzf3hIgN7zaiMGEOAjAB92EdhdQTKlNKJl/r/ejWk08Qx Av392HjoZZZgRxjEUT/BdYdz0M+dqW+pn3XWjBoDtdA6gHsd/2dz8xNamlqbnhBPcfzE UFkgPmKFT9C0oXbPfiICXyiY3I4GroCwT5f+2S+KORcE1/as3Unvcdarnvxi7zby3EiQ ywfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728673651; x=1729278451; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pPskpMoLRo5ggePJY11ysLV2Q07LApq3Krg9u+lzcgw=; b=Yp9GIDZOhesdQ8+8x67nLEo3mwOwBhhb0MF1A7NrlzsObRAsvAxTDsIuNfOPvLhBzw nM7pSRMuv06Bzzqa1wzm9lamjGtG00wcXkzgsJP1TA02yugXT4bhNhPiEf4jzBqXv2yI xpMqSinp6RJZONEYld9BtpMMrFCpWo2taaNItezSPfuBQ7egUamILmv7qFJsoTUK9boU ieIU/FvtHdNz6eBHEbwMsgAhgjEIPlYgEF33xaGPQYr8zxd8nKSsqRFIXdklBKItsxkk S3WBQ0gYO0Hvj4fkjrOfwqcVGjKztI1HVd6hqqb1mxSLByBFIfG1pMrn2VEMRy7v/Z9k o2nQ== X-Forwarded-Encrypted: i=1; AJvYcCW9AXs6yD/vkfOv3xWDnKVHkQ9fmzr39VtUgumvYEjcwGB7Z0fB5bVwaQyKCmiHKONLDr0=@dpdk.org X-Gm-Message-State: AOJu0YzUaChUmM7GspIFVMtkOpoAYD5IsfzsjhACVL8cyoY870D8WimA xc56URjKtbphifK+lBI7u0SIrjm8qhOc+4YQR2Z675vBqUXEZD0HJ9omSlvBxSs= X-Google-Smtp-Source: AGHT+IEhxqeDAZE5oIBbKe8h9pWtanopcxrth6zxbRBE44haxy3vfpETZK2nT9WODR8ZwSOstL3w3g== X-Received: by 2002:a17:902:e845:b0:20b:b26e:c149 with SMTP id d9443c01a7336-20ca1467cf5mr48448375ad.29.1728673650716; Fri, 11 Oct 2024 12:07:30 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c8c0e9b8fsm26638185ad.161.2024.10.11.12.07.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 12:07:30 -0700 (PDT) Date: Fri, 11 Oct 2024 12:07:28 -0700 From: Stephen Hemminger To: Morten =?UTF-8?B?QnLDuHJ1cA==?= Cc: "Ferruh Yigit" , "Robin Jarry" , , "Wathsala Vithanage" , "Min Zhou" , "David Christensen" , "Stanislaw Kardach" , , , "Vipin Varghese" , , "Jerin Jacob" Subject: Re: [dpdk-dev] [PATCH 1/2] mk: fix build for clang 4 Message-ID: <20241011120728.332b94ac@hermes.local> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F7C7@smartserver.smartshare.dk> References: <20170417143559.11701-1-ferruh.yigit@intel.com> <98CBD80474FA8B44BF855DF32C47DC35E9F7C6@smartserver.smartshare.dk> <20241011104817.3cabcbe4@hermes.local> <98CBD80474FA8B44BF855DF32C47DC35E9F7C7@smartserver.smartshare.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Fri, 11 Oct 2024 20:20:12 +0200 Morten Br=C3=B8rup wrote: > rom: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Friday, 11 October 2024 19.48 > >=20 > > On Fri, 11 Oct 2024 19:36:08 +0200 > > Morten Br=C3=B8rup wrote: > > =20 > > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit > > > > Sent: Monday, 17 April 2017 16.36 > > > > > > > > clang 4 gives "taking address of packed member may result in an > > > > unaligned pointer value" warnings in a few locations [1]. > > > > > > > > Disabled "-Waddress-of-packed-member" warning for clang >=3D 4 > > > > > > > > [1] build errors: > > > > .../lib/librte_eal/common/eal_common_memzone.c:275:25: > > > > error: taking address of packed member 'mlock' of class or =20 > > structure =20 > > > > 'rte_mem_config' may result in an unaligned pointer value > > > > [-Werror,-Waddress-of-packed-member] > > > > rte_rwlock_write_lock(&mcfg->mlock); > > > > ^~~~~~~~~~~ > > > > > > > > .../lib/librte_ip_frag/rte_ipv4_reassembly.c:139:31: > > > > error: taking address of packed member 'src_addr' of class or =20 > > structure =20 > > > > 'ipv4_hdr' may result in an unaligned pointer value > > > > [-Werror,-Waddress-of-packed-member] > > > > psd =3D (unaligned_uint64_t *)&ip_hdr->src_addr; > > > > ^~~~~~~~~~~~~~~~ > > > > > > > > .../lib/librte_vhost/vhost_user.c:1037:34: > > > > error: taking address of packed member 'payload' of class or =20 > > structure =20 > > > > 'VhostUserMsg' may result in an unaligned pointer value > > > > [-Werror,-Waddress-of-packed-member] > > > > vhost_user_set_vring_num(dev, &msg.payload.state); > > > > ^~~~~~~~~~~~~~~~~ > > > > > > > > Signed-off-by: Ferruh Yigit > > > > --- > > > > mk/toolchain/clang/rte.vars.mk | 5 +++++ > > > > 1 file changed, 5 insertions(+) > > > > > > > > diff --git a/mk/toolchain/clang/rte.vars.mk > > > > b/mk/toolchain/clang/rte.vars.mk > > > > index 7749b99..af34c10 100644 > > > > --- a/mk/toolchain/clang/rte.vars.mk > > > > +++ b/mk/toolchain/clang/rte.vars.mk > > > > @@ -79,5 +79,10 @@ include > > > > $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk > > > > # workaround clang bug with warning "missing field initializer" =20 > > for "=3D =20 > > > > {0}" > > > > WERROR_FLAGS +=3D -Wno-missing-field-initializers > > > > > > > > +# disable packed member unalign warnings > > > > +ifeq ($(shell test $(CLANG_MAJOR_VERSION) -ge 4 && echo 1), 1) > > > > +WERROR_FLAGS +=3D -Wno-address-of-packed-member > > > > +endif > > > > + > > > > export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF > > > > export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS > > > > -- > > > > 2.9.3 > > > > =20 > > > > > > Revisiting an old patch... > > > > > > Maybe the code causing the warnings should have been fixed instead of= =20 > > disabling the compiler warning? =20 > > > > > > We would probably handle this differently today... I wonder how many = =20 > > warnings it spews out with the warning enabled? =20 > > > > > > -Morten > > > =20 > >=20 > > With gcc-14 and re-enable packed-member and no-zero-length-bounds, lots > > and lots of warnings. =20 >=20 > Thanks for testing this, Stephen. >=20 > It seems to confirm my suspicion... >=20 > Random sampling: > - The warning in lib/ip_frag/rte_ipv4_reassembly.c is caused by using a t= emporary variable instead of mempcy(). > - The warning in drivers/bus/ifpga/ifpga_bus.c is caused by a struct bein= g packed for no good reason. >=20 > It reminds me of compiling the kernel in the good old days... spewed out = lots of new warnings when using a new compiler version. >=20 > This really should be fixed. Disabling compiler warnings because it requi= res too much work fixing the bugs is not a valid reason. +1000