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 DE83A46128; Fri, 24 Jan 2025 19:27:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 96A45402E6; Fri, 24 Jan 2025 19:27:27 +0100 (CET) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mails.dpdk.org (Postfix) with ESMTP id D02D9402CE for ; Fri, 24 Jan 2025 19:27:25 +0100 (CET) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-215770613dbso31563205ad.2 for ; Fri, 24 Jan 2025 10:27:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737743245; x=1738348045; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=04MvvE8i0JGxNPh3EgHFPP5p1NJ6qusiMILZ66Z5qIw=; b=Rl6FWBq/y1Qy0T0gEYHSB5vBxdOhUyx55zS7Mw3j5xAan51QDFnCOgVRwAip75xom5 9E45mk+T8kGdXifqRW/DW4Cb1fFqG80jowX4uWzJIpq/PVd5icWstKeLGvHZZIoi+Ge4 sNDsNYf7E0y+sWLJt/eIgpxDyPxBW+r2+cw1w0hFeGL/EGJAOl4kXOT3ibCD1KC9Oh+A /sPx5oID6ZpX/a9UXX5njiE6fMIlCrP4PFjDL8WO8R+JQMBdCXgWn6Aeenc6pcbfrskG 3kyI95LX86qcUpEPU7W4MnlREYJ1XKjpOpTMJhPYJRmaFPjMClaIW4KTTwnaM4XYpVez SC2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737743245; x=1738348045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=04MvvE8i0JGxNPh3EgHFPP5p1NJ6qusiMILZ66Z5qIw=; b=sEGKoavq8RjelOox5XkXK2WzI9LntljPPVO4gcyAfu1sTdYnPMpbhtH/8Y4Qm2jX+X JOu3vSU40Zvt703HtU1q2CYBeg7uiZeuUIhPldgYZ9cTXr+mHtcS54kEfb+5mM19KuRf wT9DriDre1UKM7/HaNq8bu/lBfaLFdHQzk0pR/8tLkQA4ma7/f3tNS1Ku/g0SW1K9Anc nJGQQPdTUl/oJUTu+YrOWAoD0bMwE0g5RZmowmGnjIYN4qKh1Y3GWYp0HEWH23vDoM+k FZCcBI240CLsNmxh4ZJVrXAgrKQ2IUox4TrKp+Ekn9tkuXkzzkpzMYAPIrLCSDQ3GyRD CXKQ== X-Gm-Message-State: AOJu0Yy2tI6CTXDrOXf0fuF6qMXWWnqbNKBU0fy9n+FAJQB0Ul+h2QQc oGLwfl4FBQ0Zy/cHUp+WrX3188kbD/Umy+MT9i07bZ6++ktR7Gy/KBAHqFFWQmEhhQwSJknabgm L X-Gm-Gg: ASbGncv5h8P54Ger7nWjMY0PKPh01YFdkG833CB2FIEhKqJNW2YUoFkKHnWBEmsnLlC gW7YtKOloXk79FsZDtTJXtZcwQA/n8+hgQEP3qIO8m9X5LlUFtNELsHGH0fXTfOBQhO+FtVPMDX rR8cQnIJmyY/o9oLvVGOnYl7DZ7y1X7OyliuRx8uRgxr7/4VFUZAxYYtEGoi8WI//1vpCJ298/c 1KxZMnoYeFBPhK1+Tkj/GxwUk3CqnE125EopzDAIkFn3eA9RFG/FwacJppzx/w0Qddi8sCY/dwF P0WYo9fispkK+a5ncjcVQRqiRprdwZeti1r5L3XMq451cjS5XB1FGIyLsA== X-Google-Smtp-Source: AGHT+IFHf7AAq6edZs0g2HluP+rvzl+ZQh03066RBg0fKi1aoOeKCGUM/mupWoW1ywbYLltNcMOdjg== X-Received: by 2002:a05:6a20:244d:b0:1db:e464:7b69 with SMTP id adf61e73a8af0-1eb214e82damr47104250637.20.1737743245104; Fri, 24 Jan 2025 10:27:25 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a7638aesm2259584b3a.102.2025.01.24.10.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 10:27:24 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Bruce Richardson Subject: [PATCH v2] build: force gcc to initialize padding bits Date: Fri, 24 Jan 2025 10:26:48 -0800 Message-ID: <20250124182647.117636-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250123172048.134417-1-stephen@networkplumber.org> References: <20250123172048.134417-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 With GCC 15, the compiler has changed the default behavior when initialization is used for aggregate variables. The new default is to follow the standard (C23) and not initialize everything by default. This breaks assumptions in some drivers and can be lead to other bugs. Use the new zero initialization flag to force of all fields to zero. Note: other compilers always initialize to zero in these cases. Only GCC seems to have decided to start initializing less as a silly attempt at optimization. Signed-off-by: Stephen Hemminger Acked-by: Morten Brørup --- config/meson.build | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/config/meson.build b/config/meson.build index 6aaad6d8a4..b6b3558e11 100644 --- a/config/meson.build +++ b/config/meson.build @@ -310,7 +310,7 @@ endif # enable extra warnings and disable any unwanted warnings # -Wall is added by default at warning level 1, and -Wextra # at warning level 2 (DPDK default) -warning_flags = [ +global_cflags = [ # additional warnings in alphabetical order '-Wcast-qual', '-Wdeprecated', @@ -330,19 +330,22 @@ warning_flags = [ # globally disabled warnings '-Wno-packed-not-aligned', '-Wno-missing-field-initializers', + + # guarantee that all non-initialized parts of structure/union are zero + '-fzero-init-padding-bits=all', ] if not dpdk_conf.get('RTE_ARCH_64') # for 32-bit, don't warn about casting a 32-bit pointer to 64-bit int - it's fine!! - warning_flags += '-Wno-pointer-to-int-cast' + global_cflags += '-Wno-pointer-to-int-cast' endif if cc.get_id() == 'intel' warning_ids = [181, 188, 2203, 2279, 2557, 3179, 3656] foreach i:warning_ids - warning_flags += '-diag-disable=@0@'.format(i) + global_cflags += '-diag-disable=@0@'.format(i) endforeach endif -foreach arg: warning_flags +foreach arg: global_cflags if cc.has_argument(arg) add_project_arguments(arg, language: 'c') endif -- 2.45.2