From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 7299D3858C60; Fri, 2 Dec 2022 14:41:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7299D3858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B2ERKuT027757; Fri, 2 Dec 2022 14:41:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=ws6d2Gwl0yzuf7j5OlXrh5H7yfT6oyLfGa8FRvxbF/U=; b=ySxlF2+oKVIrZuTpqzNamiWqXdy+EoTUudtai1dk6qq3Fm4/qLFmeQVURS8F5EXDl+2n 7PJBI8s6hcAMjWYcRBk6GbcBHF/l7i9jEDImUIMRHaGw84tfI3rJdCedJXYrfKfrjsji O0F0553VR3YE51KkD0W2cVDvYb4I7UYAm/qUK4txcch/ADIZmvjfEpC0zrDqNLh0x6XB p2efSC9d1jDfZlF89otdwZwKcj17PQ7b6HDn2XNJ2059lgRhbnPfP3Cz5iwEkqzKimMq 4kJTCqqZGF3103CFds3piDeYJOhQRVY++mRuq8+AQcvedkUvyif9gpgGvryx7oMjmedM hQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m782h1gcj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 02 Dec 2022 14:41:04 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2B2DQaWO005999; Fri, 2 Dec 2022 14:41:03 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2047.outbound.protection.outlook.com [104.47.66.47]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3m398csnqq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 02 Dec 2022 14:41:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pja0Hnk2xQsGXCKJ7jCwwYHGM7HQ7kuHJ4dmbIYCvR+Mf2fGLxl88lCyV6YPpvQ0Ai8iqTEsOQpqJgsc5Gr25T0LXdMd4ab2BlqXUwkYshmsKy30MO2YXMtj2bN7EIN8zerJEOWt+UXnulf+S1VNph/+9sKIWNZDrW43Gd7tk98a3t7AxHwFAiTVrsQ/3Zq0jealboS2LWcWhCpp5PwOpWPXCo2QvkCZIXAVHqVsAinX+WOXsIX/Vrni+qcaB49ag39leab8L3PVg91HZJEIES+moEk6Fyu/olPEjhSaK7vCZcTTiGJZAHUzVraOO6i9vKJdYfZOiY60vgMqhh9pxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ws6d2Gwl0yzuf7j5OlXrh5H7yfT6oyLfGa8FRvxbF/U=; b=KDiG3qvpH0d5wZACg4ZQH36TKlCJ1B8RP1YnjJzBHEcu99yUq/1N4h2qyD59Up7M6pdHNJS+WZOxuu/+5I72oIzTsvuEOl8HEACisnydiN8jaGeDAQ3GjCrrfBQZqZ/u7+YWzpTfukh1K1I3HRqDisK6G8fcvsEepbkWc0qfW2tiR2LjrzYvSIUxUxkcilwewcQgBs2xtGrMasmcorgbfSAVxAcHf0eGbVQX03jqH9YS8NplOt+h0RYsE2ThZCgMNYktIaj9Pv9WpMq3EZ+v4KgCOLu7E/GsyySwyPdSofH9odOqY1QIv+vS9TzeWuFx55vLfAbHP1Nt5Lz62AVimA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ws6d2Gwl0yzuf7j5OlXrh5H7yfT6oyLfGa8FRvxbF/U=; b=hkn/tOcOgZ3E5IfWZpGyY8ROGnWuABxo8uzmqHnyctzHx34WwQaOSBroIYsLWWVmq3h1X+It5dgbD5kz4axFzzL4o8S1E0Lsb7g7IZOii4q+KssUlYAoxhZdon271QuZMdmOeyhUYK7Zv+bCk219lvznT8DvrGCwUVhPqVtcVvY= Received: from CH2PR10MB4344.namprd10.prod.outlook.com (2603:10b6:610:af::19) by CH2PR10MB4215.namprd10.prod.outlook.com (2603:10b6:610:7e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.10; Fri, 2 Dec 2022 14:40:59 +0000 Received: from CH2PR10MB4344.namprd10.prod.outlook.com ([fe80::9423:79b3:c0dc:1113]) by CH2PR10MB4344.namprd10.prod.outlook.com ([fe80::9423:79b3:c0dc:1113%9]) with mapi id 15.20.5880.010; Fri, 2 Dec 2022 14:40:59 +0000 From: Qing Zhao To: Richard Biener CC: Siddhesh Poyarekar , Kees Cook , "joseph@codesourcery.com" , "gcc-patches@gcc.gnu.org" , "siddhesh@gcc.gnu.org" Subject: Re: [V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays. Thread-Topic: [V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays. Thread-Index: AQHZBMevImSRBVL0d0uKTjRLDHUDSK5ZPkgAgAAzLICAAMD9gIAAfCyA Date: Fri, 2 Dec 2022 14:40:59 +0000 Message-ID: <0F8474D7-0DC4-4EBF-9712-42B61792A0AB@oracle.com> References: <20221130142556.3079865-1-qing.zhao@oracle.com> <20221130142556.3079865-2-qing.zhao@oracle.com> <202212010840.C963E72661@keescook> <898dfeed-f392-fb86-7fbd-f99d335c7a64@gotplt.org> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3696.120.41.1.1) x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CH2PR10MB4344:EE_|CH2PR10MB4215:EE_ x-ms-office365-filtering-correlation-id: dce1509c-989a-40ca-9d74-08dad4733a6d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XlzVUypqW5h0gWo60oAWtX7BFZeLAU54D6X377GaEwUQLPw+69qbxkCafPdCnDZiLn/FxE/0WUF5cOr7QugDW5eyMPFP8nF9cHuXAA1OE8e0jIyEauyBSm+SXQ59jfvtQo4TEdAxihWtAdPAaZNUOFZ2yZ5Q8dKafBhHrMhRvvsPoWxm3p5vsQvAzyCXZQrb6WwGavd233bYD9mqVVYI31YHRUAy+aIT5szdYMTFmyrSgS6vWJ2i03hNbg3ZtaGdDtmzj8by+WmnuXRvBvT1oTSW/FvPH/3oldcSnPe/NU6obPnSTKK9BCnrQ2qK83fLAauPl0Fx7kz7laTSpEGQT+MVEwM2NI2RGRxOUQ+Pc7/FZnLBYtFJasG5laNxsABIBzRGw0pnLUYjntMw2cSR3zy//TnEf2FWlTtTUMzJWrIaB84pjCd+8NwcP0WJ61lDmlg9bQi6aCU+QvH3DRDyr+3DAtfCQeTP+WT9Ti4Owth8oMW+nnqacBPFRwLXEzFmf6CWSwDJgX0xWZgm/ZQZh0vtpWkDYAFKgYkAPNNzNxyFo9YQLUU6PUN8EyNqPpxIWhEOBhtqQMdzo86iNrBm06MhDgY+PuGPwpsDFtZg35PWAz6vI6lli5aULrT/rQSBMbKJE2k4mLTwY8Oj0tSCksYfrHFsdiz1Hj9M44HIqZGlV5xunYPHtnRIj6BJXds9IhKKLm932ht9uG3GIrneOprVaq1JlUclFAcgsOaS7DQ= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH2PR10MB4344.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(346002)(39860400002)(136003)(366004)(396003)(451199015)(83380400001)(33656002)(86362001)(6486002)(478600001)(71200400001)(38070700005)(36756003)(2906002)(122000001)(38100700002)(2616005)(6512007)(5660300002)(44832011)(6916009)(26005)(53546011)(4326008)(6506007)(186003)(54906003)(66446008)(66946007)(66476007)(76116006)(64756008)(8676002)(91956017)(41300700001)(66556008)(8936002)(316002)(45980500001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Xg5fniUem6gifQ/k22i5loOsY5UqMK2BUf751LHBPIPToI3qDgZAmRaFTVY3?= =?us-ascii?Q?B3HllPfNcV+m4LFVoa5cowfvPRKWx/+5ftLXPOqDQFfmIFchS5sbztnKUWa6?= =?us-ascii?Q?Z7d6UNihfy41w+Kq0Py9jInTVJXd24eDT3HCMQJPIhZIAvq9zmvTXer93wfh?= =?us-ascii?Q?0ebFGXctbXsP24LWZ+6Zwj1zOtUhqgj8MxMrGk3wdQUmifDTEPh/9rGTokL8?= =?us-ascii?Q?RwvjBsFf8ZL9Gg3jtWCt2CGlfAWAORZF+0+si+u4xM6+p4WuOsFlG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8Ac9DqDZGq7qghlKNJAdJXp3aqe?= =?us-ascii?Q?E4IoCijmPr17BlvLaE3iYTEsGkRI9QVfbRogmcaTQQWwGLTNGOUBWetNW6m0?= =?us-ascii?Q?I+dM7vMnUKlc6Kf8fneso/dm2aOe8RrbmtpTLpfidvtW1ZYf99+7+C9T99r5?= =?us-ascii?Q?9wqg9iNaced4+KgztoZCgnL3kq6x2dTzOMeuJcnKHGuVBgZNaproSVsBs8Bt?= =?us-ascii?Q?77bPRYEA2O3kC8frEIA1xnlPhRf6a9wB/38fGFT576GVDECJ48zjz08lVmyV?= =?us-ascii?Q?BcgX+HdCTLZMQHVI5iyovFy7s5WFyeox1b044XUQMPw+a82/Zo6/CMK5DoDX?= =?us-ascii?Q?NgfVLORLATdOqFFuqgrFMujsNBNQuOeoYHADR3hb97QHdwZkwM5GA/vPcti8?= =?us-ascii?Q?ht/V7v75K2jbEFNg46ehLDNFtavjNZNwbFGZLG2d?= Content-Type: text/plain; charset="us-ascii" Content-ID: <961A53F5610DDE469DC8925E6D923B22@namprd10.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: WVq8K8IykGsxafjgq0ZByaIdcOiyDbS51xCcI5RJxXT+uZNDGrFlD/cx8x09EKFo27pF/L5/ejwe2ely3DtvqxFCy90ZhiQ2zrllUmCCTVgT3uY72wdF/c6UCnaGReGA5DZkFGOJIY9gJEyj/3uq+6JkVgGH72niCyiX2IUVtsc3Vl8Vh9g9C4/tUUTv8tkdZTK0WoEiqTJ2ZpuLy1/YXjO1BKxGEdVEq2AWRT41GhouC98LahYAapCJvNsntaqkbka4SLMe7IZApoyqp5AwUM11gEPh7MBrAIW/yaLyWx1JxRvty6b9/TqMMwM9GiXkmZXJbMiZ2Z+mW/KQqse5fRe5RRP9zYWy1tO7ANHQY2Gar7lkG/9Wm29lpc14rgcu+Zjiekqrbo43zc5gBCMSCwcH33/DYFO/I5LnfNYb0wcw0mBi6/aYZZo/99SCclT7SNuq7saPdDOjpcF0SvkiL3D7DoZKld9MV07lHiLmlp+sp3e38nWnIMLzv0vSWU/CVWZZlIqAMt4q93Mh3vNqa7IoGZYQRXElqMRyqdhCtp9XWB/cKPcBNGujg8TgOfOHGjnqITXXHz6cGDacO6ph7wH7HuMYICAP0Zo1AwcvZcgJ8+e5S54kmRO+3uMTrxOQXMhQgaxJk4SWEZUojfXLh0yHBajpp6UWTQbt8DIMN+D/RCMau7UQIRDwe/av4+U89SIXGUV2mUlpKw8RyIS4Gq3bI0P7IXERjJHdnMWzguo48v9Jfvtdg2oOdIPU/2FCusppYgh+XyNzdPAvZ9afrm0DXePfvXridkgFh8czoWLvDir82itlmccctWZKwzz9cS7nq+JnhiLrRBi4HElw5hO55J6D+GWFfiEt4sIjs1Vf0d0Wj2k9OL0zP6yGuKkoqRbdgs8wWjXk3fdKYZRaoa7/5RfRVvPmHPAo9rzzJD8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH2PR10MB4344.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dce1509c-989a-40ca-9d74-08dad4733a6d X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2022 14:40:59.2311 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: X8Copiv0tZ2YZEkMzolq3P68h8VxrKl2FTFvRSsaWUXHfxgmuBF5ijjfr84CXlcroaAXf3QSEHa0G3sUyauCGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4215 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-02_07,2022-12-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212020114 X-Proofpoint-GUID: ChVPo-72Qu_i33jix6HMXeZu1_daUJFq X-Proofpoint-ORIG-GUID: ChVPo-72Qu_i33jix6HMXeZu1_daUJFq X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > On Dec 2, 2022, at 2:16 AM, Richard Biener wrote: >=20 > On Thu, 1 Dec 2022, Siddhesh Poyarekar wrote: >=20 >> On 2022-12-01 11:42, Kees Cook wrote: >>> On Wed, Nov 30, 2022 at 02:25:56PM +0000, Qing Zhao wrote: >>>> '-Wstrict-flex-arrays' >>>> Warn about inproper usages of flexible array members according to >>>> the LEVEL of the 'strict_flex_array (LEVEL)' attribute attached t= o >>>> the trailing array field of a structure if it's available, >>>> otherwise according to the LEVEL of the option >>>> '-fstrict-flex-arrays=3DLEVEL'. >>>>=20 >>>> This option is effective only when LEVEL is bigger than 0. >>>> Otherwise, it will be ignored with a warning. >>>>=20 >>>> when LEVEL=3D1, warnings will be issued for a trailing array >>>> reference of a structure that have 2 or more elements if the >>>> trailing array is referenced as a flexible array member. >>>>=20 >>>> when LEVEL=3D2, in addition to LEVEL=3D1, additional warnings wil= l be >>>> issued for a trailing one-element array reference of a structure = if >>>> the array is referenced as a flexible array member. >>>>=20 >>>> when LEVEL=3D3, in addition to LEVEL=3D2, additional warnings wil= l be >>>> issued for a trailing zero-length array reference of a structure = if >>>> the array is referenced as a flexible array member. >>>>=20 >>>> At the same time, -Warray-bounds is updated: >>>=20 >>> Why is there both -Wstrict-flex-arrays and -Warray-bounds? I thought >>> only the latter was going to exist? >=20 > Sorry for appearantly not being clear - I was requesting=20 > -Wstrict-flex-arrays to be dropped and instead adjusting -Warray-bounds > to adhere to -fstrict-flex-arrays in both =3D1 and =3D2 where then =3D2 > would only add the intermediate pointer results verification. So, you suggested to drop the new option -Wstrict-flex-arrays? How about the new warnings on the misuse of flex arrays? Shall we drop them= too? Or we issue such new warnings with -Warray-bounds + -fstrict-flex-arrays= =3DN? I still think that the new -Wstrict-flex-arrays to only issue the misuse of= flex arrays is necessary to add. Otherwise, such warning messages will be buried among a lot of out-of-bound= s warnings. >=20 > I think that's reasonable if documented since the default behavior > with -Wall will not change then unless the -fstrict-flex-arrays > default is altered. Yes, the default behavior for -Wall, or -Warray-bounds are not changed. Qing >=20 >> Oh my understanding of the consensus was to move flex array related diag= nosis >> from -Warray-bounds to -Wstring-flex-arrays as Qing has done. If only th= e >> former exists then instead of removing the flex array related statement = in the >> documentation as Richard suggested, we need to enhance it to say that >> behaviour of -Warray-bounds will depend on -fstrict-flex-arrays. >>=20 >> -Warray-bounds does diagnosis beyond just flexible arrays, in case that'= s the >> confusion. >=20 > Richard. >=20 > --=20 > Richard Biener > SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg= , > Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman; > HRB 36809 (AG Nuernberg)