Message ID | 20250415184626.4081794-1-qing.zhao@oracle.com |
---|---|
State | Committed |
Commit | 727f330f9ac661339af1121fc5c9b67dd0d35872 |
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 04FA33858C48 for <patchwork@sourceware.org>; Tue, 15 Apr 2025 18:47:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04FA33858C48 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=UPf8+Gpf; 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=CpN5S04G X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 6A4FC3858D29 for <gcc-patches@gcc.gnu.org>; Tue, 15 Apr 2025 18:46:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6A4FC3858D29 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 6A4FC3858D29 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1744742795; cv=pass; b=UQjtf2yGBrIu8/fsXNANj3KSPOjDc36j25cvR5eS5+9JNo5QwRvwkDuC55H0labSgDAKxRBx2v8AKPxoXtLgzq0IrqKIj9xM9XSU/N3NjuYHb4IOJfkKiU1iqsG0DzJY8Q5eF4OgDfZoanvq3K9qlzGOdtgNp/5Vkp7mQhWuEhE= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1744742795; c=relaxed/simple; bh=EgbeqPP4uk75Kcj50e55ryJFyENwDgn2fqdUJtu6A+E=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-Id: MIME-Version; b=hoAmgNZqdWboJakpAFnEFILwvKpMfvfZMQFczJdFFs4niSAlK10sWCkAn1Vqfa0SKXQtvjT6N7ZdEiKfPWlI3MmnixkGxAyagVjnWkf7fZuJKfmtxRZhv8nD79P1Rp79+cO1yjtoCAAlelbZBEFfHUhM+e4jOwrxub3sf+luhqM= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A4FC3858D29 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 53FIfo9R008266; Tue, 15 Apr 2025 18:46:34 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=QiL05JwdXh21KPxr DR1NgtzRom/YItdVFcjg65O7O18=; b=UPf8+GpfMYRDAR4lJvwDT+p1uJAjLC5v t05+GQBi2w8yAE+wu/F3RMiIxOuKQNfiovJvpItPwUr/jAzUpFu70dJ7Q/PZayj4 a+2LwAJPBhKl9XPFx0mAb62y/R2Lm/AT2uMSgjb+W/YP6xIk/ca0PgU0tdjSXiG7 +ooEOHzMH7PYCyKCmNw9O0l6wkyLBCxof+Qg8TOqMaeO18Z8iytKtc14rQE/Kocg zGf25+9R1RvxxcY7zNNFiYBiwMdS0Fq+uVsENz6GsubhT7pglqEG7e5IEr4ABBT3 n5kIf3ovzbh/XYBUAzyT7X4nAc7hhhZgcYL2EEdIF6e+EtVQQgKH2A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 461944a89v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Apr 2025 18:46:34 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 53FIdCG5030982; Tue, 15 Apr 2025 18:46:32 GMT Received: from sa9pr02cu001.outbound.protection.outlook.com (mail-southcentralusazlp17011029.outbound.protection.outlook.com [40.93.14.29]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 460dbb1qxb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Apr 2025 18:46:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=d5qoIrFgMtyhi6BXm4cSYbxFYRnE69A7tFi7u9MfmA4dhoNNfQjLpSb6CTFQNMlByCgeR4STCtfQwTH2h8Wxguh4dj4/lx5HfYgZWEraAoDlyW2R8RMwSBU7yYVzBmzvkaZ1IIYVo3FBO2IjsPVC3uCxI/cwKmtqRJk9dyBBQWLNWnzwYbKI1ESgK00Bjo78ucPyHr8hDiORAKJqYZyxIRrIg+RQhP6KpNWRiWxQFNazFuCwsIUrTVWGXcjSpSlz3wtdO8nIQFshpqmlMcpfBstUwUzMrdxfPBehqY+D1GeQ/HCn56jrcPjV26Yuaqe5yMMpS0l1SyX2/04Ds6gCWw== 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=QiL05JwdXh21KPxrDR1NgtzRom/YItdVFcjg65O7O18=; b=I0BHjWN5W88Tl9FsYPNbM04P5wjfhgDrBhyuKe/FvTYSRefxtWoqTSQwkSiNt5CfsV3HdVH1UBLSeooM1bEgzcsL4O1pUgaS0VuF2r/0wHWGRpO7Pfv4qCEYmrjrDJuUvTXOdVN5bMqye4cXhU8rFaYB1CdTIx7inmHisOXeah2g6YhP4ac6pPiPtxSsc4LeUrOBB77oVjYGamO9ip8cE33kM2Q1hYXQSo3vH+lAr1+NDkIF0Q1xH+yTB8YVIbkFb3vEHD17VT0VZz9hTXVSjoW9k5ixWSIIEzwJiiACEVu9EiQ4dmjPCH8UDbK04OeBkWaovjJp9+z9ayul9wWujQ== 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=QiL05JwdXh21KPxrDR1NgtzRom/YItdVFcjg65O7O18=; b=CpN5S04GI/pxXgXcNpEv6qe4n7fNbbPgy2NNlQ0WBOLOy+g114I6zk5x2DrL7WSfVl1eCEvgH5KxgK/8f2emWxChwTCy1rhRon8pfvGROtsAmLrNjxMn4UavyRB+705t/Za3Lck/po3+qwjmFJisW7LR+igD4/LxqyNsmEt/26U= Received: from CY8PR10MB6538.namprd10.prod.outlook.com (2603:10b6:930:5a::17) by BN0PR10MB5158.namprd10.prod.outlook.com (2603:10b6:408:120::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8632.33; Tue, 15 Apr 2025 18:46:29 +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; Tue, 15 Apr 2025 18:46:29 +0000 From: Qing Zhao <qing.zhao@oracle.com> To: josmyers@redhat.com, polacek@redhat.com, uecker@tugraz.at Cc: gcc-patches@gcc.gnu.org, Qing Zhao <qing.zhao@oracle.com> Subject: [PATCH v2] c: Fully fold each parameter for call to .ACCESS_WITH_SIZE [PR119717] Date: Tue, 15 Apr 2025 18:46:26 +0000 Message-Id: <20250415184626.4081794-1-qing.zhao@oracle.com> X-Mailer: git-send-email 2.31.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0P220CA0008.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:41b::17) To CY8PR10MB6538.namprd10.prod.outlook.com (2603:10b6:930:5a::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB6538:EE_|BN0PR10MB5158:EE_ X-MS-Office365-Filtering-Correlation-Id: 439cffc2-136e-4313-c3b5-08dd7c4dd538 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: Pa/LDsPJP9KMNFCP+KqlxX8bp3A852id71BqTHgF3pl4C/dsZ0TQylSdyXeuZxpg8aP3SOnvAxkVDfQuJF83eQ4f2beutM8KHgz6Rg7g4dkSlMQfzT79tlyRZ4TNblIIbbOYKBoB/yLxTcMOWN5IuvoCKfu4tba4C+AK9OZWxqfFDAKpV4XNalrsYftZStVE8hVW0xRoK9xpKKzg1gHE+gJP4cIjLGAsM2cg+ui16vxf+FRDdCCucwGGO8tczGGLKd58BQ2PtpB1ykyF1MOQVYsDENT6XSYSZN8xZjzMMPnWAqKiBrA0fVPXbBFaNeg25ugluQnswqdfovcFYrrQzW4IamrkFs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CL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB6538.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7AFDPayqM0++QYRAduZTpabF58Kr9gaPYXIDpgdjssI7DcFv8uYDG9JqJvjhfi3wF3RBRgEiHnlJowQINtrtVTn7JztVlYzk3WFJ21GqMtq/x3Avy0BPJAUOWz49pp1tnpX94nNFUcDMPy0fyhqGw8xc5uR/iKEN7bGuhjr+lbC1yFvSLhmn5uXF1evqL9DyBqkqtRmhb815vabxcp3thZJwXV2XDXnnVnKEvRQ9dvSb+ow1yOIs7rSlX2i8hXR0jr0RLMdY2UX9DN40wgD9fwPwqvZ+s+PY6/Yq3ANqoCSAhxkG40+rA2qMtfF0tur47EhsCYZ4zyIp4hiOfjYXaPd0rIIISqs9MkKLKXRpQvkT1tTL4ujIo4NLHRb4slXKx2USfqKggK2YBqW9Tlvh/zNI2rixU7drz5TT3JWPvwdt8yOR5J3EmTXrUxw4D+7QxohdDO1jdDpXCt9mSxs2FHCgrgnX3V0e6hVx2JfdvQbhvQfuwfVnVqGtJb1LQySt2ZuxRGviBtF91v+t/QxAsH/k1xMFg5S91DftJi7fXinsdOrQ+tzMRDgOBbpXwfnv3FxPrzRC4gb3b2lAK/rUF4EAzqr8w7IXX1InyGZf0hEP83IzTbSSy2poTaW244S5qQL2iXkleQd1UpakOlTmpeD+vUP2B8sI/jtj7Ws5BqZHBueynCgz13ic1ojxgGN4rfQC5HDxQyzNEUM8fnw3AYvhNKvVB6x0TtsQb4DOMRj5AxjQRJFUfh6iD1Bykc3JDSg4tyZljENCfZ8rdH6J2TSUvlSlZ74Z6xr9MllTPPZMHFc68CPnXe5Uw82SDu0Q8PO72nAd54JKmUYMIzMgElcezkU3ItGg59OSyBVR02R5tQ64WfpPyt43kbzElSLX/kNG163z1m9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THgX874XV4SU+I3ALs9tV9IwuFbm/PIVY0t3BLj/CHtf7lJCc0Up/04LObD2V5EPeqmngNQz55rJRDqPuZo4+nPKr7y6HrfqE9apLBNJNK8fjg+EthVgcQ21+/lc2DQambKTDNO28ks4jG4czpZ5T5kMSLDHAwAgNqf0VEIkP8ch26PZqVXwuvidxhVXEELZb+wnbIdNvuEutCfAFubMF7QroaFHb4PjeoqEcctdh5WhKe1AU1ty7EhiIfDQEJJ7MgCIyVp1HP1+SqTLhUhrEQCMGY2MYC90CZOQvHd1/U/ktwk7raFXf5U6f7QK+c= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 439cffc2-136e-4313-c3b5-08dd7c4dd538 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB6538.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2025 18:46:28.9765 (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: MmQSIBunBqXHU36nEGTga8Tni9qxRbbFkaTQvsO78jonRIWAws1C10mxnaK2MQUJfwWGR1sezZFI3lK+YTcUKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5158 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-15_07,2025-04-15_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 phishscore=0 mlxscore=0 mlxlogscore=972 bulkscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2502280000 definitions=main-2504150130 X-Proofpoint-GUID: pCgPOovSqKo3AgmisxbHXUXMeMHGQgq4 X-Proofpoint-ORIG-GUID: pCgPOovSqKo3AgmisxbHXUXMeMHGQgq4 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 |
[v2] c: Fully fold each parameter for call to .ACCESS_WITH_SIZE [PR119717]
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gcc_build--master-arm | fail | Patch failed to apply |
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap | fail | Patch failed to apply |
Commit Message
Qing Zhao
April 15, 2025, 6:46 p.m. UTC
This is the 2nd version of the patch, the change is to replace "FALSE" with "false" per Marek's comments. 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. Bootstrapped and regression tested on both x86 and aarch64. Okay for trunk? 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 Tue, Apr 15, 2025 at 06:46:26PM +0000, Qing Zhao wrote: > This is the 2nd version of the patch, the change is to replace "FALSE" with > "false" per Marek's comments. > > 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. > > Bootstrapped and regression tested on both x86 and aarch64. > Okay for trunk? LGTM now, thanks. > 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..55d896e02df 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; > +} > -- > 2.31.1 > Marek
Thanks. Pushed to trunk. Qing > On Apr 15, 2025, at 14:56, Marek Polacek <polacek@redhat.com> wrote: > > On Tue, Apr 15, 2025 at 06:46:26PM +0000, Qing Zhao wrote: >> This is the 2nd version of the patch, the change is to replace "FALSE" with >> "false" per Marek's comments. >> >> 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. >> >> Bootstrapped and regression tested on both x86 and aarch64. >> Okay for trunk? > > LGTM now, thanks. > >> 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..55d896e02df 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; >> +} >> -- >> 2.31.1 >> > > Marek
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 3870e8a1558..55d896e02df 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; +}