Message ID | 20250414202855.176269-1-qing.zhao@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 67A3E385843D for <patchwork@sourceware.org>; Mon, 14 Apr 2025 20:29:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 67A3E385843D Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2023-11-20 header.b=dR26NFqi; dkim=pass (1024-bit key, unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=xYZPQLfN X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 3F06D385840C for <gcc-patches@gcc.gnu.org>; Mon, 14 Apr 2025 20:29:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3F06D385840C Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3F06D385840C Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1744662542; cv=pass; b=CqKfE5H9XF/TRexkKoeetQ4MZFppaBbBuOeo+gfMcvGY533QL9F1H1E5kuG35RcD3+Vg1BVpHxYNY/Ul6wAQ+02ZMFR6vWeQ8JE70U4ANzsBXNYB4A9EZljrQEVIuc4Lb0WJP1XrRdshsgbinCRo6wKRGMH8/Vx+1ffPdAOOsZQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1744662542; c=relaxed/simple; bh=7PlrJd3h3+oPBel8e+QS+Vsz9zIOg9xdKU1+WEPqsvg=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-Id: MIME-Version; b=HESVIwfN7yAcjei+P5GMvv5UP5EJX+D4wl8Qo0Q4v/KaIchtwFB/kfwC9UQksIHeszqMTUCdpFr7UvYcKQgzkoY0DKWtaqGPe4stDJKtxIOYbKz2AJFUmNcJY0eQkNgmdsMG+hir5n8rVZaEYgZHJfmvU5i4PAnLoAQK46nfV1o= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F06D385840C Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 53EIq162019839; Mon, 14 Apr 2025 20:29:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=corp-2023-11-20; bh=M+pZVaMb4OGcDTGa IyS4NsI9HzvCek3g6AdiiturpVI=; b=dR26NFqiR55Z0kuu8X0G3RdkuoSQjo07 nh40uhDDqnQRCb5C4bziVdiS3SYjLbTPPZR0UbO7gOjA5yiMOC85Es7lo1rt+Xfr zSzARaF+KjbAIMyJIS5Exl5H2FyUyCFNjohqZPBADIt4t/dnu9/wodEEv8E5+jrd JAx7x6asQNp8ql3bkClcxPFB/9UvVte2rvtlRTms7Z4Zbxs+ZBc0YkI3nJxsO6Gn sGTEtNQy/k8Vs9xU3mBYDaSwtzE7xrGtPgfHqb+KXst6Pi7IkJv0PRks591of0wp dsbod8g9wc2yUsk4gS/BgqZ1b03pAfI2ndBQusErZliOCmLHkSIa3A== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 46180w86q7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Apr 2025 20:29:01 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 53EJJw4g005739; Mon, 14 Apr 2025 20:29:00 GMT Received: from ch5pr02cu005.outbound.protection.outlook.com (mail-northcentralusazlp17012053.outbound.protection.outlook.com [40.93.20.53]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 460d5u8rdb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Apr 2025 20:29:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S2ULaE0U6vMqRM/lybRoyiBJiz4Yiplptsea7VvpS9hENzHR+n6mT9hvD0sNUhY/uLNoFjTQlyEtcrBaWoiLe2OcKNLAy9rfyBPdLuZq/NaC6ekgsXA1CPToUG2zLbv2UNHqefcS+dXQeGGmIcz8mhga2nh1xBNUOJNUjG7jw2Cka1T5JkMnVwyeIrjrcR1MvdkTDviDx50rqZPJAmdaNGAqdG1Gkyey4LUjSnkSK/WxcuTypAMkuJGzXdT7qxY7/gtLJoJhX/zIOt6aUfKE+B3fHwc7qNh6PHJBxfjncZbIF/05w53OzuUjaipTqxyVJgcWdZGbzAn4gjL0hFGTaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=M+pZVaMb4OGcDTGaIyS4NsI9HzvCek3g6AdiiturpVI=; b=ZMV9oZWkohIdXZEMxocNGkzuMMdLGOAw3D44++4xh05TMjFGBn+hQ2mBId8bBkyXqU3JWdM5Dp0PwOSW5TbIKFk2NHyRebil1LP/iESL/DB87R7kD9qWL/384HFmKMkvcPGa8a3pxIUAg7Nnmf2sB/PC6bizD3umOurwp97AxUW2SsuvNkdbNz+8AlDYQl/SPNLXfRQtVbxLy96L4NiH9eXXpUJZTUlAKbMM4Y0HpCkwMiFrMWd5z99vNmRCp7hKLzgBrpQIyUoBOwZNtYVyLLORetsLWhBN9jUUeV3ct+ZFPaCx73unJEGev1vkLCbC2SRny9RpwSVOHrBrbxrfGA== 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=M+pZVaMb4OGcDTGaIyS4NsI9HzvCek3g6AdiiturpVI=; b=xYZPQLfN+Z/LxHXTKfr/AVAZqQ9Jm2ROFCXf98i8FMTewgosVEL3W2+EYV5vXlWNtM49f6fliNV2ethggz6FCgpOQ0SSvMKzSkL6E/zfrY8aVvGBR68kWcfl4LwOacpB3MkrawY10yzpjY91H8xQdvcI06dbJsTbsBSjWmM3LOs= Received: from CY8PR10MB6538.namprd10.prod.outlook.com (2603:10b6:930:5a::17) by IA1PR10MB5993.namprd10.prod.outlook.com (2603:10b6:208:3ef::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8632.32; Mon, 14 Apr 2025 20:28:57 +0000 Received: from CY8PR10MB6538.namprd10.prod.outlook.com ([fe80::8a:61cd:764a:e47]) by CY8PR10MB6538.namprd10.prod.outlook.com ([fe80::8a:61cd:764a:e47%5]) with mapi id 15.20.8632.030; Mon, 14 Apr 2025 20:28:57 +0000 From: Qing Zhao <qing.zhao@oracle.com> To: josmyers@redhat.com, uecker@tugraz.at Cc: gcc-patches@gcc.gnu.org, Qing Zhao <qing.zhao@oracle.com> Subject: [PATCH] c: Fully fold each parameter for call to .ACCESS_WITH_SIZE [PR119717] Date: Mon, 14 Apr 2025 20:28:55 +0000 Message-Id: <20250414202855.176269-1-qing.zhao@oracle.com> X-Mailer: git-send-email 2.31.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR08CA0023.namprd08.prod.outlook.com (2603:10b6:a03:100::36) To CY8PR10MB6538.namprd10.prod.outlook.com (2603:10b6:930:5a::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB6538:EE_|IA1PR10MB5993:EE_ X-MS-Office365-Filtering-Correlation-Id: fdb1d187-45f1-49fd-18b1-08dd7b92fbda X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: UJKmU21GjsDotBoL/rgS9haXcxQCeXf+E4bEYXf6TwV83vOwa9mH26gMgIIAP8G8GlEclzpiCCzsF5UrVI1aYsp1j++2jnB7V76GLn6XpjO6CApRWrKgy52QmFH3/2k8sNw/w5gYM2jVsv3mQ7sTBQn2ordqnCWVi5h42ivw20zhHY6gvJKeiczw8B1SSvQq2QyqQSvELUby511NvH/V4N8m7ihtpUq5xqq3NwfSZh2SK+wsQ9AF7tqrygN50M7DCAyuxOj+EiWxHUasQQQiSOHToJ1F/xhjEHcncpw4urYT4WongvOI6vsVnApho0uEcI7oYYkN7iPzWUYbjGOmguOYZTu/xIcqfRh0P68+6EeSfRI/IbaxqOivCX3d37J9cQkdzrbo4uTg70h7k6vqnVJneWCEedW5Q1rRkzwXlbJ5u+rVmnWtSrqH3/y3gSXuum7scKb50HY0OKFBhj4om61bMM+Bd1COCdDu1LRzOo5OrJs8/Tnta/sigJeO/1ytrLJp51mAx74XM+PzkpoAZzhtkRVX4SWZH3HN4cnY5tE83jziKuq5AMCx1Jfa8xGmU8jHVbHP2r3SwxkaoxC7dqJatwPu3qaZMkGIGCdMP2u6efHblY9Qbqz3pFyfWeNjAmcof05WcXsta+0g8nrazd22DX1IqnwhlUwwgWE4wWj93akc57p1GSUJ87Y2X4oNzU2WLKXAjAGLa8GTVIBgVJkzVsCrYzeK9rSKlsL4aQw+lqZ1MQte4TXuiA3imbIAEpS2R5dtvDuCbtSUITEWIiXkSd+D9mZxsLv+5zHHtmVOawvSM8SECx08WI2zUGuzVlMi7pIKaDD/CZPllOY1y6ivZlKOh9z0N41BfsLBsipo4+XpN4fXHeMJtLWtiKoWUMZ/CNzpLtl6/pKfMehd12xY09ZX1C100OdhINQRn0My7Ah2mTQkryqlRLpyBWahrdbscnBsERKTOshc9RPfuFozjZT6xCWFpzg5AgSCyJ45VFkqRjzONc5P/jKGsyRkG3lvnpiXObMMdgp9dveJznf8QCrQ0lV1BtomNDL2lxdz6uPmURQ3OMm1hvsdfmJ2JuFbcO5yG0VRGwBcbUhWo2AmLd7vVIb3ynSgUqFuIzgd+4ljkTZwvz/Af1m5uKAwtcjd21cXgtbTx0aWteM9+HZJiRhbrfVUJymfjmfZP9kjzUUGPHXbD1Ps2QOC0qd0VDzxNDNetGRDE/CDrnXNxt2hOdKdIN17HfhxWRerVMA9AWtGpixWr+bMqD8Z6Vf14QqTtMA4vSer+yTF0gEanQca3SPi1W0A7ovCBVTfnpIBTIiOH912NIK40Af9oCyHIL/sz2tvoLvEhcezSaCRzIEoIsATsa7bK98oT22eb9g= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB6538.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024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YU0FbCAaRiyLmhwLWYzNV2uLdyEtSrf1XtJptusJx/gVjadrCCmlUaqyxmWP152wpSx8U4FCYCMvyfkkOWNZKrOZM6IJXuVL305r/j8FkstBj0vKvraN/ZsCeXqee2JNR/TMrHQMdocbdnvJy9BHgjIXqcubVrDecZT01Khz5YCnRDc3xh8gFvi6yBm5pA09U8CjYnemvLOy0eGhEzVR6bj+jPwEX3orR13NHxXTiLM5DQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdb1d187-45f1-49fd-18b1-08dd7b92fbda X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB6538.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2025 20:28:57.8486 (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: tEdJQ0xG+/ZpUb2/Fe/QsLaDO7Pc0yB0w9B+RsZrXm5msU7Uunv2s28bsWxLQgpvlCHySUx6VClZ9mjgSYXZog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB5993 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-14_07,2025-04-10_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 bulkscore=0 malwarescore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2502280000 definitions=main-2504140149 X-Proofpoint-ORIG-GUID: Iu-nQ_thvRvJiXZSQMliKv8539CKUprb X-Proofpoint-GUID: Iu-nQ_thvRvJiXZSQMliKv8539CKUprb X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
Series |
c: Fully fold each parameter for call to .ACCESS_WITH_SIZE [PR119717]
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 | success | Build passed |
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 | success | Test passed |
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap | success | Build passed |
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap | success | Build passed |
Commit Message
Qing Zhao
April 14, 2025, 8:28 p.m. UTC
C_MAYBE_CONST_EXPR is a C FE operator that will be removed by c_fully_fold. In c_fully_fold, it assumes that operands of function calls have already been folded. However, when we build call to .ACCESS_WITH_SIZE, all its operands are not fully folded. therefore the C FE specific operator is passed to middle-end. In order to fix this issue, fully fold the parameters before building the call to .ACCESS_WITH_SIZE. I am doing the bootstrap and regression testing on both X86 and aarch64 now. Okay for trunk if testing going well? thanks. Qing PR c/119717 gcc/c/ChangeLog: * c-typeck.cc (build_access_with_size_for_counted_by): Fully fold the parameters for call to .ACCESS_WITH_SIZE. gcc/testsuite/ChangeLog: * gcc.dg/pr119717.c: New test. --- gcc/c/c-typeck.cc | 8 ++++++-- gcc/testsuite/gcc.dg/pr119717.c | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr119717.c
Comments
On Mon, Apr 14, 2025 at 08:28:55PM +0000, Qing Zhao wrote: > C_MAYBE_CONST_EXPR is a C FE operator that will be removed by c_fully_fold. > In c_fully_fold, it assumes that operands of function calls have already > been folded. However, when we build call to .ACCESS_WITH_SIZE, all its > operands are not fully folded. therefore the C FE specific operator is > passed to middle-end. > > In order to fix this issue, fully fold the parameters before building the > call to .ACCESS_WITH_SIZE. > > I am doing the bootstrap and regression testing on both X86 and aarch64 now. > Okay for trunk if testing going well? > > thanks. > > Qing > > PR c/119717 > > gcc/c/ChangeLog: > > * c-typeck.cc (build_access_with_size_for_counted_by): Fully fold the > parameters for call to .ACCESS_WITH_SIZE. > > gcc/testsuite/ChangeLog: > > * gcc.dg/pr119717.c: New test. > --- > gcc/c/c-typeck.cc | 8 ++++++-- > gcc/testsuite/gcc.dg/pr119717.c | 24 ++++++++++++++++++++++++ > 2 files changed, 30 insertions(+), 2 deletions(-) > create mode 100644 gcc/testsuite/gcc.dg/pr119717.c > > diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc > index 3870e8a1558..dd176d96a41 100644 > --- a/gcc/c/c-typeck.cc > +++ b/gcc/c/c-typeck.cc > @@ -3013,12 +3013,16 @@ build_access_with_size_for_counted_by (location_t loc, tree ref, > gcc_assert (c_flexible_array_member_type_p (TREE_TYPE (ref))); > /* The result type of the call is a pointer to the flexible array type. */ > tree result_type = c_build_pointer_type (TREE_TYPE (ref)); > + tree first_param > + = c_fully_fold (array_to_pointer_conversion (loc, ref), FALSE, NULL); > + tree second_param > + = c_fully_fold (counted_by_ref, FALSE, NULL); Why FALSE? Just use false. You can also use nullptr rather than NULL now. > tree call > = build_call_expr_internal_loc (loc, IFN_ACCESS_WITH_SIZE, > result_type, 6, > - array_to_pointer_conversion (loc, ref), > - counted_by_ref, > + first_param, > + second_param, > build_int_cst (integer_type_node, 1), > build_int_cst (counted_by_type, 0), > build_int_cst (integer_type_node, -1), > diff --git a/gcc/testsuite/gcc.dg/pr119717.c b/gcc/testsuite/gcc.dg/pr119717.c > new file mode 100644 > index 00000000000..e5eedc567b3 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr119717.c > @@ -0,0 +1,24 @@ > +/* PR c/119717 */ > +/* { dg-additional-options "-std=c23" } */ > +/* { dg-do compile } */ > + > +struct annotated { > + unsigned count; > + [[gnu::counted_by(count)]] char array[]; > +}; > + > +[[gnu::noinline,gnu::noipa]] > +static unsigned > +size_of (bool x, struct annotated *a) > +{ > + char *p = (x ? a : 0)->array; > + return __builtin_dynamic_object_size (p, 1); > +} > + > +int main() > +{ > + struct annotated *p = __builtin_malloc(sizeof *p); > + p->count = 0; > + __builtin_printf ("the bdos whole is %ld\n", size_of (0, p)); > + return 0; > +} > -- > 2.31.1 > Marek
> On Apr 14, 2025, at 16:35, Marek Polacek <polacek@redhat.com> wrote: > > On Mon, Apr 14, 2025 at 08:28:55PM +0000, Qing Zhao wrote: >> C_MAYBE_CONST_EXPR is a C FE operator that will be removed by c_fully_fold. >> In c_fully_fold, it assumes that operands of function calls have already >> been folded. However, when we build call to .ACCESS_WITH_SIZE, all its >> operands are not fully folded. therefore the C FE specific operator is >> passed to middle-end. >> >> In order to fix this issue, fully fold the parameters before building the >> call to .ACCESS_WITH_SIZE. >> >> I am doing the bootstrap and regression testing on both X86 and aarch64 now. >> Okay for trunk if testing going well? >> >> thanks. >> >> Qing >> >> PR c/119717 >> >> gcc/c/ChangeLog: >> >> * c-typeck.cc (build_access_with_size_for_counted_by): Fully fold the >> parameters for call to .ACCESS_WITH_SIZE. >> >> gcc/testsuite/ChangeLog: >> >> * gcc.dg/pr119717.c: New test. >> --- >> gcc/c/c-typeck.cc | 8 ++++++-- >> gcc/testsuite/gcc.dg/pr119717.c | 24 ++++++++++++++++++++++++ >> 2 files changed, 30 insertions(+), 2 deletions(-) >> create mode 100644 gcc/testsuite/gcc.dg/pr119717.c >> >> diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc >> index 3870e8a1558..dd176d96a41 100644 >> --- a/gcc/c/c-typeck.cc >> +++ b/gcc/c/c-typeck.cc >> @@ -3013,12 +3013,16 @@ build_access_with_size_for_counted_by (location_t loc, tree ref, >> gcc_assert (c_flexible_array_member_type_p (TREE_TYPE (ref))); >> /* The result type of the call is a pointer to the flexible array type. */ >> tree result_type = c_build_pointer_type (TREE_TYPE (ref)); >> + tree first_param >> + = c_fully_fold (array_to_pointer_conversion (loc, ref), FALSE, NULL); >> + tree second_param >> + = c_fully_fold (counted_by_ref, FALSE, NULL); > > Why FALSE? Just use false. You can also use nullptr rather than NULL now. Just replaced FALSE with false. I am keeping NULL to be consistent with other calls to c_fully_fold in the same file. And testing the new version now. Thanks a lot. (With FALSE, the compilation went fine…) Qing > >> tree call >> = build_call_expr_internal_loc (loc, IFN_ACCESS_WITH_SIZE, >> result_type, 6, >> - array_to_pointer_conversion (loc, ref), >> - counted_by_ref, >> + first_param, >> + second_param, >> build_int_cst (integer_type_node, 1), >> build_int_cst (counted_by_type, 0), >> build_int_cst (integer_type_node, -1), >> diff --git a/gcc/testsuite/gcc.dg/pr119717.c b/gcc/testsuite/gcc.dg/pr119717.c >> new file mode 100644 >> index 00000000000..e5eedc567b3 >> --- /dev/null >> +++ b/gcc/testsuite/gcc.dg/pr119717.c >> @@ -0,0 +1,24 @@ >> +/* PR c/119717 */ >> +/* { dg-additional-options "-std=c23" } */ >> +/* { dg-do compile } */ >> + >> +struct annotated { >> + unsigned count; >> + [[gnu::counted_by(count)]] char array[]; >> +}; >> + >> +[[gnu::noinline,gnu::noipa]] >> +static unsigned >> +size_of (bool x, struct annotated *a) >> +{ >> + char *p = (x ? a : 0)->array; >> + return __builtin_dynamic_object_size (p, 1); >> +} >> + >> +int main() >> +{ >> + struct annotated *p = __builtin_malloc(sizeof *p); >> + p->count = 0; >> + __builtin_printf ("the bdos whole is %ld\n", size_of (0, p)); >> + return 0; >> +} >> -- >> 2.31.1 >> > > Marek
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 3870e8a1558..dd176d96a41 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -3013,12 +3013,16 @@ build_access_with_size_for_counted_by (location_t loc, tree ref, gcc_assert (c_flexible_array_member_type_p (TREE_TYPE (ref))); /* The result type of the call is a pointer to the flexible array type. */ tree result_type = c_build_pointer_type (TREE_TYPE (ref)); + tree first_param + = c_fully_fold (array_to_pointer_conversion (loc, ref), FALSE, NULL); + tree second_param + = c_fully_fold (counted_by_ref, FALSE, NULL); tree call = build_call_expr_internal_loc (loc, IFN_ACCESS_WITH_SIZE, result_type, 6, - array_to_pointer_conversion (loc, ref), - counted_by_ref, + first_param, + second_param, build_int_cst (integer_type_node, 1), build_int_cst (counted_by_type, 0), build_int_cst (integer_type_node, -1), diff --git a/gcc/testsuite/gcc.dg/pr119717.c b/gcc/testsuite/gcc.dg/pr119717.c new file mode 100644 index 00000000000..e5eedc567b3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr119717.c @@ -0,0 +1,24 @@ +/* PR c/119717 */ +/* { dg-additional-options "-std=c23" } */ +/* { dg-do compile } */ + +struct annotated { + unsigned count; + [[gnu::counted_by(count)]] char array[]; +}; + +[[gnu::noinline,gnu::noipa]] +static unsigned +size_of (bool x, struct annotated *a) +{ + char *p = (x ? a : 0)->array; + return __builtin_dynamic_object_size (p, 1); +} + +int main() +{ + struct annotated *p = __builtin_malloc(sizeof *p); + p->count = 0; + __builtin_printf ("the bdos whole is %ld\n", size_of (0, p)); + return 0; +}