From nobody Thu Apr 9 07:15:58 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA82F36E47E for ; Tue, 10 Mar 2026 10:17:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773137844; cv=none; b=WjvGR3Ksn0f0Y03Jl2Ly7zU1xZVc9pe+8QAqcv03LedG11heGW9IPSV7SIaZArBrKBlJBDvGfpfcBgGcJIEPuDE55VR/RWztVCJEuL9e7J38u490iHgScrOm9p9KJvXcOh/9gwmif0hYdoxZmNfjhXGKePVxCsqRo7iT+jf4lrs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773137844; c=relaxed/simple; bh=VIkREqUo3yOmbLLPwC7NBVaAcaZwDL4fH36IVLykzF0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=eJZakZHMBig7k/DOB/iX5nGkiJK41IhJ+W2NyIii+sB1ekbP9aSqFoMMCUrEy5lGXXlK7LSO73XnthAbpRwXebP16mTGJGA22tM81Y+jnjii0BIHwaThzdsHfXQW057I7Ly4Z4mpO7pYxr6N/9ZA/fO6z3hlsckgQd4Caf7F/Ew= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=fbUZpbJe; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="fbUZpbJe" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62A56bJw509351; Tue, 10 Mar 2026 10:17:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pp1; bh=iesZ9SxOi2m5Xy54SPaHS4tPpuhw x5hKwA7bM2riaBk=; b=fbUZpbJeNDwKAQMTeAaCF7xreNu8EyEew4UI8JG58i+G a4UldEbNuKfrdXxaNjPyndu+R8eR8eMfxZZ7NFM6T5w61Gk5/EF1IZCouIjd+rGs pEuAhnJT6DKMYf5VujmeUoWQ54xDI1VLinA/n1y/6C9AmKqROWY57Suy5G63F4pB rZtVkUB4KMSuk62GtN551XjPRsa4VN4e/o12XskLdD1eckDTsVo1dUtl5FQ5nwDm v/xl9TnbhNQ9Vf5Qed7W3k+BAMFoYq59OEHAs/XEDVG7fQXBgszlVas39+Lv7zyf atSnMbj357y0+rWxOBfmKTLdfeAbZtnQH8jOBhVsBQ== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4crcywabqx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Mar 2026 10:17:01 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 62A60odp021365; Tue, 10 Mar 2026 10:17:01 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4crxbsrrxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Mar 2026 10:17:00 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 62AAGv2949545652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Mar 2026 10:16:57 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5FA9E2004D; Tue, 10 Mar 2026 10:16:57 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 78DFA2004E; Tue, 10 Mar 2026 10:16:55 +0000 (GMT) Received: from mac.in.ibm.com (unknown [9.98.111.16]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 10 Mar 2026 10:16:55 +0000 (GMT) From: Amit Machhiwal To: Madhavan Srinivasan , linuxppc-dev@lists.ozlabs.org Cc: Vaibhav Jain , Amit Machhiwal , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Greg Kurz , linux-kernel@vger.kernel.org Subject: [PATCH] selftests/powerpc: Suppress false positive -Wmaybe-uninitialized with GCC 15 Date: Tue, 10 Mar 2026 15:45:19 +0530 Message-ID: <20260310101519.67157-1-amachhiw@linux.ibm.com> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEwMDA4MSBTYWx0ZWRfX1NisxH/IH940 L+2ztO8/+HyWqpgi5Ft0KC2S5cjni+JtxwHdGf4XqppgOG0EVYsmeYWUGUZgRt+Lr67v0B0eYT1 h6SIosiM5XPhp5vNIaU7YMJ1HirksTVEEP4a6audyUNbdJa2lPbd16Jw/JhM2Se29bq9T08bL8C 5EIjn4ZMyJ6CLXnei+n8LYoucIq9JX0tdM56+QsnYIwC50edDoUqbxMzXI6xbeMg6iQwdVTeZ8w AW8dspbS9+2WYIkdIbh248iKQsaB2NLKw49ngU3+lW+uhHk92zPR4Mzm/QPjwVcMCO4Us9LzbTM ihQ82X4mZYTCmhjWKg6vXFHizpbYbTzLyTAVLEbkT6i8/IgqIkhcP4uubM+8JcNji6x+/ivnMV/ B+4TMQPMBFyjJqPbHAJJ33nFtAyfIgLMY2Dp39rHdxLIgiCWRLgPEiokKCg/wLQ8kRJI2caODjb ij7Al73dTee832YhI5A== X-Authority-Analysis: v=2.4 cv=QaVrf8bv c=1 sm=1 tr=0 ts=69afef9e cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=mDV3o1hIAAAA:8 a=VnNF1IyMAAAA:8 a=TLf-jbbItdWWZ-izWCQA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: SVtSYDVzzIvTFT2n0xrlB1Pu1W_q6LTU X-Proofpoint-ORIG-GUID: cl2Q4MMu8IC3_A4RcuuuAxi2u91kZuam X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-10_01,2026-03-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 impostorscore=0 clxscore=1011 adultscore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603100081 GCC 15 reports the below false positive '-Wmaybe-uninitialized' warning in vphn_unpack_associativity() when building the powerpc selftests. # make -C tools/testing/selftests TARGETS=3D"powerpc" [...] CC test-vphn In file included from test-vphn.c:3: In function =E2=80=98vphn_unpack_associativity=E2=80=99, inlined from =E2=80=98test_one=E2=80=99 at test-vphn.c:371:2, inlined from =E2=80=98test_vphn=E2=80=99 at test-vphn.c:399:9: test-vphn.c:10:33: error: =E2=80=98be_packed=E2=80=99 may be used uniniti= alized [-Werror=3Dmaybe-uninitialized] 10 | #define be16_to_cpup(x) bswap_16(*x) | ^~~~~~~~ vphn.c:42:27: note: in expansion of macro =E2=80=98be16_to_cpup=E2=80=99 42 | u16 new =3D be16_to_cpup(field++); | ^~~~~~~~~~~~ In file included from test-vphn.c:19: vphn.c: In function =E2=80=98test_vphn=E2=80=99: vphn.c:27:16: note: =E2=80=98be_packed=E2=80=99 declared here 27 | __be64 be_packed[VPHN_REGISTER_COUNT]; | ^~~~~~~~~ cc1: all warnings being treated as errors When vphn_unpack_associativity() is called from hcall_vphn(), this error is not seen during compilation because GCC 15 seems to consider 'retbuf' always populated from the hypervisor which is eventually referred by 'be_packed'. However, GCC 15's dataflow analysis can=E2=80=99t prove the sa= me before the first dereference when vphn_unpack_associativity() is called from test_one() with pre-initialized array of 'struct test'. This results in a false positive warning which is promoted to an error under '-Werror'. This problem is not seen when the compilation is performed with GCC 13 and 14. Suppress the warning locally around the offending statement when building with GCC 15 using a diagnostic pragma. This keeps the build working while limiting the scope of the suppression to the specific statement that triggers the false positive. An issue [1] has also been created on GCC bugzilla. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D124427 Fixes: 58dae82843f5 ("selftests/powerpc: Add test for VPHN") Reviewed-by: Vaibhav Jain Signed-off-by: Amit Machhiwal --- arch/powerpc/platforms/pseries/vphn.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/powerpc/platforms/pseries/vphn.c b/arch/powerpc/platforms= /pseries/vphn.c index 3f85ece3c872..9bc891143fec 100644 --- a/arch/powerpc/platforms/pseries/vphn.c +++ b/arch/powerpc/platforms/pseries/vphn.c @@ -39,7 +39,22 @@ static int vphn_unpack_associativity(const long *packed,= __be32 *unpacked) be_packed[i] =3D cpu_to_be64(packed[i]); =20 for (i =3D 1; i < VPHN_ASSOC_BUFSIZE; i++) { +/* + * When this function is called from hcall_vphn(), GCC 15 seems to consider + * 'retbuf' always populated from the hypervisor which is eventually refer= red by + * 'be_packed'. However, GCC 15's dataflow analysis can=E2=80=99t prove th= e same before + * the first dereference when this function is called from test_one() with + * pre-initialized array of 'struct test'. This results in a false positive + * '-Wmaybe-uninitialized' warning which is promoted to an error under + * '-Werror'. This problem is not seen when the compilation is performed w= ith + * older GCC versions. + */ +#pragma GCC diagnostic push +#if defined(__GNUC__) && __GNUC__ >=3D 15 +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif u16 new =3D be16_to_cpup(field++); +#pragma GCC diagnostic pop =20 if (is_32bit) { /* base-commit: 1f318b96cc84d7c2ab792fcc0bfd42a7ca890681 --=20 2.50.1 (Apple Git-155)