From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id E1CFB383B2AD for ; Wed, 10 Apr 2024 19:08:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E1CFB383B2AD Authentication-Results: sourceware.org; dmarc=fail (p=quarantine dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E1CFB383B2AD Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712776093; cv=pass; b=Wb38G8IuK8eBQWPCu2khabnPqScehc4Sb+4fGFjMBlzqA2bBNqz73CBeuelmndk8CPtaaBMoOggLvDvx6ZLIRB4i9k+Jd+J7rk/6oG2c50/N+E+DkIP30tqlNxN3cNvntZf6ORL6v2jrJE8HOlJ/5fxFs/d1OrxOlscRLoBDQtk= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712776093; c=relaxed/simple; bh=WAlwSmEm//KJSgHntJB4OmizgiLYgBKsTclwD6Lle/Y=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:Subject:To:From: MIME-Version; b=P1Hlga1sSeWJ3jw5ZvGz80dQgRQxqq3uipEatRgP5MVf7YHkMYivC7TOAu19RpQjIg5Wf/k1P3wuESgDermjefo/Dp9zNwb88IEoxvUSchfL6zZBGx+ju1QLGW1Pyfob6mqoW9wJuqC7iMXaFiklxPwQm4tc3CGA6uhuYqJINZo= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rudIe-0006uu-7c for gcc-patches@gcc.gnu.org; Wed, 10 Apr 2024 15:08:02 -0400 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43AIlkVh027204 for ; Wed, 10 Apr 2024 19:06:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=message-id : date : subject : to : references : from : cc : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2023-11-20; bh=JfMci/ehBnWXY6zZe66yc4SC+btHzl61hVxcK5sdGNg=; b=Zn3GJAL5fI8MarBpynDWGP2on9e8zFsLvmTd+AAukXBpjdAslPYzM8uZ1w/hXzEmTqun f5T8hN7LYLPq5jYtv4X9MloVpu7X48d57mIKo7jj8kSlIrfoukBrT3QeQU/4jh93oLNh xC11u3FDgk9ADywvhqB9GuExqPHoXvS9eBYNIzjqeNs8dZ7NRZGnPuk5Gw8aCTxNPxm8 Lzt2TAGlHEJy01YcYjhFmbVss6O05LEPVAPwrpPjHnts8WxLhB2jhEBl/ZKTj6EE49PX fKoKHHOggWG6LhniDxESNVy72jfpYHN+7bEhh17243aUAxycgO3EcmRfsfEnemuvmRrz vg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xax0ur4a3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Apr 2024 19:06:55 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43AHTYdS010569 for ; Wed, 10 Apr 2024 19:06:54 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3xavu8kg73-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Apr 2024 19:06:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OfjS9rMAnVqwvpqAl+O5LAkbvjLAWkbNCKRBmHkA2ojxKPlBl1QiahF/ktmj2f8R0Va0+BnPs4ht7yf1IhPtWAUHONno9Y1v5/qVVfvSe4WHyswVSWYOMqNQYPHzDgdqWaPHEZcYx4/jVrMX8IVlmzv3Bc59cSiDryrgm7M411wdBiK+qTzm53SX8pUv0DfNscBghPp9IAgARkkMDCcvKLrhkIc8IV1GKtCtwl6ImxCstnMJBHRg37XGMqVKxDUifWEloe//VOCoS4bP4LafeOFfPWrULTJehshlzGbYyH0pnoShe9+35bcOODPpUGbXORZII+crqQf82a6rso440g== 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=JfMci/ehBnWXY6zZe66yc4SC+btHzl61hVxcK5sdGNg=; b=hwN5Rp2Bri//MWUsPuuuPfTsgjhh7R4mYlR1uZDuvyOzl4lr2Hbt3mkD83pMEITsd+NnCIIbD3ie9OwreRzi1PNKPj5lvcglJvLJtqy67oy3N3CPcAxuSrNUxA22YB2xzwqBKKZ4/vG9ncrVmHTp6D8OzNhVuQ3UZer0BOYRoL24WXyBfTr+G+M9YhVGb8Uhoc/O86WP+O3HkQ6U8VNnv4wlUCM4+VfoZM3AyucktyMvAy4PligIhh3osJh8DU9o8tiLcHK7cfpGcPv6f+GJ0Oq1UvZDDcIDzBnI8463mInDdZYoSw4Mdq7m576LvpMn2URTH+suPg2FG/JlhA3kXg== 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=JfMci/ehBnWXY6zZe66yc4SC+btHzl61hVxcK5sdGNg=; b=IZEd1aaP6HIHF0x8B33VKrDYNLKiG4cRO7956+51fRNwEyNZXzJzibO5lKkmvy6JmS+5HsroIHSImAlf1UKpJ0qF8Zc7Xm4UXpEf1JhMkxtoxp4ZDm0SKTH2mQPBBJ60mJwLhIFRI+G8T75X0zYt5tqSA9qvKMzE/3fWRjaU3SU= Received: from DS0PR10MB7953.namprd10.prod.outlook.com (2603:10b6:8:1a1::22) by PH0PR10MB4581.namprd10.prod.outlook.com (2603:10b6:510:42::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.54; Wed, 10 Apr 2024 19:06:52 +0000 Received: from DS0PR10MB7953.namprd10.prod.outlook.com ([fe80::ddec:934d:1117:499d]) by DS0PR10MB7953.namprd10.prod.outlook.com ([fe80::ddec:934d:1117:499d%3]) with mapi id 15.20.7409.042; Wed, 10 Apr 2024 19:06:52 +0000 Message-ID: Date: Wed, 10 Apr 2024 12:06:49 -0700 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] ctf: fix PR debug/112878 To: Indu Bhagat References: <20240410182511.1528093-1-indu.bhagat@oracle.com> <20240410182511.1528093-2-indu.bhagat@oracle.com> From: David Faust Content-Language: en-US Cc: gcc-patches@gcc.gnu.org In-Reply-To: <20240410182511.1528093-2-indu.bhagat@oracle.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BYAPR05CA0033.namprd05.prod.outlook.com (2603:10b6:a03:c0::46) To DS0PR10MB7953.namprd10.prod.outlook.com (2603:10b6:8:1a1::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7953:EE_|PH0PR10MB4581:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7+8wRjzll3uVPna5RAeW31COp6Z1NmEV9YZgG7pGDuWPktLynZcroq/kikDa6KwufCpTxLBolQowt8xcJF0a0hYtj7dKugq9qtiXLS/oxCSjpTcENmY/E1yZhnm5KD/PzHqDQnlx8OMboypUNg26WJW2vh+zYa9AgX9iMtuxe5HWlzruHYrksnS3WQS5cF/EJbImgZRnZLbmrNgmaz+4sfmgLI13NulSepJws3S1U4VjMIEWXtWrAziswh6eo2uoyb7NGeEy45sva/9fX2nLrx0bXtAaGCdTxlYCq0FbhsSYT22M2M1XFPIMgwq5289UIwfLNwneQMyaPvs2A+lUt5Ey+wR/CucVb5C+EsZoWKRHu0Mi3d8u2XGF5PMqu+wXjHMLdMxt5topbHBue2YfV1HP+2Bk+y1DBHRK1mvtkgIczUlmBxqZwpcmRkDM39OY4d0gFr/hZ+Z2w/bqOnfZGvRh4eZtAHBS7wGTKaNO1EBXkCY1zGIs8OagTy5cZP0Cj+094fIbCUxNsHRfd8CTasRU4gQCfUoXslFoquL+cVJCCaPTHSrDQfVEock8wLU6uMFx3UIvO9u69HJi3Zq055ZY0RZuCa3f9IBbobZA3bk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR10MB7953.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(366007)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZFBGdVNKOGxiK05yajdTYzJXTGdsY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Dby+V4Hwbo4XKfU3l5w= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 094affc9-c1c8-4823-81bf-08dc59916167 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7953.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2024 19:06:52.1706 (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: DyMVEiTLPQQLL7x8/bWwa/C8LFXECT/v033pOwlDsUl8rBh4w2Oa+/qjUv3m7OLz8WLxbe5+eZ9CjZmt5chOJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4581 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-10_04,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 suspectscore=0 spamscore=0 mlxscore=0 bulkscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404100140 X-Proofpoint-GUID: cVIsxt7eZyqVftV2lSQxSPm_64ZiJ1YY X-Proofpoint-ORIG-GUID: cVIsxt7eZyqVftV2lSQxSPm_64ZiJ1YY Received-SPF: pass client-ip=205.220.177.32; envelope-from=david.faust@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DKIM_VALID_EF=-0.1,RCVD_IN_DNSWL_LOW=-0.7,RCVD_IN_MSPIKE_H4=0.001,RCVD_IN_MSPIKE_WL=0.001,SPF_HELO_NONE=0.001,SPF_PASS=-0.001,WEIRD_PORT=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_NUMSUBJECT,SPF_HELO_PASS,SPF_NONE,TXREP,WEIRD_PORT 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 4/10/24 11:25, Indu Bhagat wrote: > PR debug/112878: ICE: in ctf_add_slice, at ctfc.cc:499 with _BitInt > 255 in a struct and -gctf1 > > The CTF generation in GCC does not have a mechanism to roll-back an > already added type. In this testcase presented in the PR, we hit a > representation limit in CTF slices (for a member of a struct) and ICE, > after the type for struct (CTF_K_STRUCT) has already been added to the > container. > > To exit gracefully instead, we now check for both the offset and size of > the bitfield to be explicitly <= 255. If the check fails, we emit the > member with type CTF_K_UNKNOWN. Note that, the value 255 stems from the > existing binutils libctf checks which were motivated to guard against > malformed inputs. > > Although it is not accurate to say that this is a CTF representation > limit, mark the code with TBD_CTF_REPRESENTATION_LIMIT for now so that > this can be taken care of with the next format version bump, when > libctf's checks for the slice data can be lifted as well. OK. > > gcc/ChangeLog: > PR debug/112878 > * dwarf2ctf.cc (gen_ctf_sou_type): Check for conditions before > call to ctf_add_slice. Use CTF_K_UNKNOWN type if fail. > > gcc/testsuite/ChangeLog: > PR debug/112878 > * gcc.dg/debug/ctf/ctf-bitfields-5.c: New test. > --- > gcc/dwarf2ctf.cc | 15 ++++++++++----- > .../gcc.dg/debug/ctf/ctf-bitfields-5.c | 17 +++++++++++++++++ > 2 files changed, 27 insertions(+), 5 deletions(-) > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-5.c > > diff --git a/gcc/dwarf2ctf.cc b/gcc/dwarf2ctf.cc > index 77d6bf89689..dc59569fe56 100644 > --- a/gcc/dwarf2ctf.cc > +++ b/gcc/dwarf2ctf.cc > @@ -606,11 +606,16 @@ gen_ctf_sou_type (ctf_container_ref ctfc, dw_die_ref sou, uint32_t kind) > if (attr) > bitpos += AT_unsigned (attr); > > - field_type_id = ctf_add_slice (ctfc, CTF_ADD_NONROOT, > - field_type_id, > - bitpos - field_location, > - bitsize, > - c); > + /* This is not precisely a TBD_CTF_REPRESENTATION_LIMIT, but > + surely something to look at for the next format version bump > + for CTF. */ > + if (bitsize <= 255 && (bitpos - field_location) <= 255) > + field_type_id = ctf_add_slice (ctfc, CTF_ADD_NONROOT, > + field_type_id, > + bitpos - field_location, > + bitsize, c); > + else > + field_type_id = gen_ctf_unknown_type (ctfc); > } > > /* Add the field type to the struct or union type. */ > diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-5.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-5.c > new file mode 100644 > index 00000000000..fee8228647c > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-5.c > @@ -0,0 +1,17 @@ > +/* Bitfield where the bit offset is > 255 is not allowed in CTF. > + > + PR debug/112878. > + This testcase is to ensure graceful handling. No slices are expected. */ > + > +/* { dg-do compile { target bitint } } */ > +/* { dg-options "-O0 -gctf -dA" } */ > + > +/* No slices are expected, but a struct with one member is expected. > + CTF_K_UNKNOWN is also expected. */ > +/* { dg-final { scan-assembler-times "cts_type" 0 } } */ > +/* { dg-final { scan-assembler-times "\[\t \]0x1a000001\[\t \]+\[^\n\]*ctt_info" 1 } } */ > +/* { dg-final { scan-assembler-times "ascii \"unknown.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ > + > +struct { > + _BitInt(282) a : 280; > +} b;