From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 68900A0032;
	Thu,  1 Sep 2022 10:24:00 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 580C041155;
	Thu,  1 Sep 2022 10:24:00 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com
 [67.231.156.173])
 by mails.dpdk.org (Postfix) with ESMTP id ADA4440395;
 Thu,  1 Sep 2022 10:23:58 +0200 (CEST)
Received: from pps.filterd (m0045851.ppops.net [127.0.0.1])
 by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2815SG9C006022;
 Thu, 1 Sep 2022 01:23:55 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : mime-version : content-transfer-encoding :
 content-type; s=pfpt0220; bh=EnSF0d0d2hl9dW8ycqQWXjnd3+i/auNCaL2310QE1+U=;
 b=iIC3xSO73uRq7frlkPbmJ3VRZm4Az2c6S3C2UsRtuiDBFR6OxGFyL/LvtpdOC0RHk+7l
 z94i9RxjRbfjDWAO86VV8ffxxQU3A0NQ8z1d7Dc4BCnGvWlR2D82lAf37mfrz+AuOfBn
 mz0qZBpozQWv2uagQAriel35Ger80yJYAk938tR5FCVjCAnzq3HPSSKBR9Ic52reO8E/
 TSFSr0h7HFCmD2nb9Uoe6rywjmHyxDvTGQGtE/u0fN1AqMRuXHDoXIh+4VL9Kh9WOaiK
 JGHIRT48oE/5WG/rb14tpjCuHPV3CD8WYOWJSDT8d5FmJ7/p6ytbHTMd9uYs3Jv1B0nX uA== 
Received: from dc5-exch02.marvell.com ([199.233.59.182])
 by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3ja3vemvfd-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Thu, 01 Sep 2022 01:23:54 -0700
Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;
 Thu, 1 Sep 2022 01:23:52 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend
 Transport; Thu, 1 Sep 2022 01:23:52 -0700
Received: from localhost.localdomain (unknown [10.28.36.157])
 by maili.marvell.com (Postfix) with ESMTP id C497B3F7050;
 Thu,  1 Sep 2022 01:23:50 -0700 (PDT)
From: Amit Prakash Shukla <amitprakashs@marvell.com>
To: Ruifeng Wang <ruifeng.wang@arm.com>
CC: <dev@dpdk.org>, <jerinj@marvell.com>, <stable@dpdk.org>,
 <gakhil@marvell.com>, Amit Prakash Shukla <amitprakashs@marvell.com>
Subject: [PATCH] examples: compilation fix for GCC-12
Date: Thu, 1 Sep 2022 13:53:43 +0530
Message-ID: <20220901082343.3074804-1-amitprakashs@marvell.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-ORIG-GUID: RTAGtyNfszExyug3QUY_rLQ8LXMJ4Kdk
X-Proofpoint-GUID: RTAGtyNfszExyug3QUY_rLQ8LXMJ4Kdk
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1
 definitions=2022-09-01_06,2022-08-31_03,2022-06-22_01
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

GCC-12 warns when a pointer of type union points to an array of same
defined size, as union internally gets paded with pad bytes.

../examples/common/neon/port_group.h:42:21: error: array subscript
	'union <anonymous>[0]' is partly outside array bounds of
	'uint16_t[5]' {aka 'short unsigned int[5]'}
	[-Werror=array-bounds]
   42 |                 pnum->u64 = gptbl[v].pnum;
      |                     ^~
../examples/common/neon/port_group.h:21:23: note: object 'pn' of
	size [0, 10]
   21 | port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1
      |              ~~~~~~~~~^~~~~~~~~~~~~~~
../examples/common/neon/port_group.h:43:21: error: array subscript
	'union <anonymous>[0]' is partly outside array bounds of
	'uint16_t[5]' {aka 'short unsigned int[5]'} [-Werror=array-bounds]
   43 |                 pnum->u16[FWDSTEP] = 1;
      |                     ^~

Fixes: bdfc3816fbfc ("examples: common packet group functionality")
Cc: stable@dpdk.org

Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
---
 examples/common/neon/port_group.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/common/neon/port_group.h b/examples/common/neon/port_group.h
index 82c6ed6d73..97da604583 100644
--- a/examples/common/neon/port_group.h
+++ b/examples/common/neon/port_group.h
@@ -24,7 +24,7 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1,
 	union {
 		uint16_t u16[FWDSTEP + 1];
 		uint64_t u64;
-	} *pnum = (void *)pn;
+	} __attribute__((__packed__)) *pnum = (void *)pn;
 
 	uint16x8_t mask = {1, 2, 4, 8, 0, 0, 0, 0};
 	int32_t v;
-- 
2.25.1