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 5CF2843E33; Wed, 10 Apr 2024 23:18:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EAF85402D4; Wed, 10 Apr 2024 23:18:26 +0200 (CEST) Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by mails.dpdk.org (Postfix) with ESMTP id 47D98402C7 for ; Wed, 10 Apr 2024 23:18:26 +0200 (CEST) Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6ed691fb83eso2545984b3a.1 for ; Wed, 10 Apr 2024 14:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1712783905; x=1713388705; 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=CvXznzAzUzybLMRP7RDTqAO0eoWzciFzVUGZSQdziNI=; b=PDeQ+Zj68Om7mIu/O4pVQ4DA+EjG1073VTDfAiKdzSjHz1gP0/B5e/W8S63+sqk1EQ 4A70Xh5IyXnjmKUQuP2XJhPoGEnByL05s3d9NwDeKVvRYdtyLhWICQ7Z3NE82SKTk1Pf mvjSFWi+NXFOzeVXlBNt8KzBrJP9NT8K6ypYhoFTIkwItfsxsFdGVTWzsgYQlVFE91xB GExuvctCe0zTda4u6nt6xT49Wn0bA3o78NVia9r25xS8ys2qxtJ6rJUie/IMe9G9Q8+u WMjt3deaa1TSPM9BH5DqX/SjPTdvswzUmmcK40zKl4tqm47egdS2WNx+Mi4nJv33rQ11 knnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712783905; x=1713388705; 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=CvXznzAzUzybLMRP7RDTqAO0eoWzciFzVUGZSQdziNI=; b=eZ7ipYc2yNZXpc5rhRt3AE02KiTma/HyjDVK9Oq6jyJ1p3XKu3SidY8mrlO1Q1SdLu YhA25xoU1JIneD7EoHdYAhLzRD9nN8azdRgQ+ZLEzrIQaMj3pNT3w8Z+HBQ1rsrr3rwJ uujqFMGcHfXa2wYXCDYIBU0LQE7xpfoJBH8XjUsbTo6xwMLOZ+6DspZYzrEFDU3csy5A y8nQHMNvoXJ7Ipvouf7r7DFnvvCnrAfpknpNwLhsj3/Zzt69Uioad7GUiBF+X4NHHUnt 7XLoZKo94yeEjciM98wfg+SO9tY9XeWgHF8fBLgsBUaH7Zwgwtx3O/lSXgJFdPAmK/47 ga1A== X-Forwarded-Encrypted: i=1; AJvYcCVDrPrV/f6HoyXje0DPa0Uo23NXaVHyr+hGDfcRhrL/SdZlGpvalhiAklI2HCfAVSgRcq/Ph0yXnAu9Xi0= X-Gm-Message-State: AOJu0Yy0NKRJIDm77IH10Xnb55xei0FiOam+F46B2ic4T8z34wRx6D4T gaASEA9h8IlOnCU+qrVRmzo3Ni250OkAkTLvaGZT6oNA40IeJ/HwnNQPqrd3gy4= X-Google-Smtp-Source: AGHT+IHPQ45ygQy5utbK0SscBJkNKONgJHlOrnxPMczw0bEQ7vBgxnTkMXa8z6RaDPCAZAN4N8zCXg== X-Received: by 2002:a05:6a20:2591:b0:1a7:9812:3680 with SMTP id k17-20020a056a20259100b001a798123680mr4214370pzd.40.1712783905074; Wed, 10 Apr 2024 14:18:25 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id gm7-20020a056a00640700b006ecfdcc2de9sm97003pfb.10.2024.04.10.14.18.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 14:18:24 -0700 (PDT) Date: Wed, 10 Apr 2024 14:18:22 -0700 From: Stephen Hemminger To: Morten =?UTF-8?B?QnLDuHJ1cA==?= Cc: "fengchengwen" , "Ferruh Yigit" , , "Dengdui Huang" Subject: Re: Strict aliasing problem with rte_eth_linkstatus_set() Message-ID: <20240410141822.0fe8c10a@hermes.local> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F391@smartserver.smartshare.dk> References: <8175c905-e661-b910-7f20-59b6ab605c38@huawei.com> <20240410082704.4691d7df@hermes.local> <98CBD80474FA8B44BF855DF32C47DC35E9F391@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 Wed, 10 Apr 2024 19:54:27 +0200 Morten Br=C3=B8rup wrote: > > Please send a patch to replace alias with union. =20 >=20 > +1 >=20 > Fixing this specific bug would be good. >=20 > Instinctively, I think we should build with -fno-strict-aliasing, so the = compiler doesn't make the same mistake with similar code elsewhere in DPDK.= I fear there is more than this instance. > I also wonder if -Wstrict-aliasing could help us instead, if we don't wan= t -fno-strict-aliasing. Strict aliasing checks should be enabled already if you use warning_level 2 and default (debugoptimized) or release build types. Unless some part of DP= DK meson config is not overriding that. https://mesonbuild.com/Builtin-options.html Warning level 2 sets -Wall and -Wextra =46rom gcc man page -Wstrict-aliasing This option is only active when -fstrict-aliasing is active. = It warns about code that might break the strict aliasing rules t= hat the compiler is using for optimization. The warning does not ca= tch all cases, but does attempt to catch the more common pitfalls. = It is included in -Wall. It is equivalent to -Wstrict-aliasing=3D3 and The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.