From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 89021385801B for ; Wed, 30 Mar 2022 23:31:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 89021385801B Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22ULUDZs030420 for ; Wed, 30 Mar 2022 23:31:50 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com with ESMTP id 3f1se0jwa5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 30 Mar 2022 23:31:50 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 22UNMbIT007313 for ; Wed, 30 Mar 2022 23:31:48 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2047.outbound.protection.outlook.com [104.47.66.47]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3f1s979708-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 30 Mar 2022 23:31:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LrwglVF/b9CRseCNBLFwvFQgGrsij/ls/ApEhGkelKFJ3b7oxea0z7PYGxB7PQCVSut603de9q7cIb/Q2/nmIcYJvfzcVC3mNEB4PTRKFyJgHjAz704zWuwqQdkXA30HHkYcj8p4g6nhDxw6zqsW1oWvVdIS3SJwKXJ5ubliSH0Uym/uKFDsCFoUZVisktImkozgvBednbIcfcliiwrjlCQQBkrZV83k/F/C2wzdAIWjuygHsiS8eLWRnktCDbsZ/1qFokgrENF2B/QDKc7RNbluFI307EwmRu8WhUHlW0KON5LhJTJzpd1LJpEb5Rxv/REuSrGfif8TOVHRN8ZaOw== 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=anQAncxqiji/18HtyEjtOM82O9yMT0G4Qc5Q8dDJxuE=; b=Lb1ymnuqb7LlOsh9BzAKGxhvlCiRFm/733VSHvXsG9jI6Ieihd9KFJ1EIy2YI45YZSkAFMfvuSj0WJtcKO12xGddBHqVaxh9Z4DKpBDBjEMcXiO+EhzG2dn5qhlNbn4Zl/BCa2LkkesI5sP1Gcrmoze+KweAs5+45tLGKFoLDnxfshk7fQQiMwDPqNXHVlSQyPrQtmewwj4bu5e06bW3GfQCV8qBkWAdkX01Sve/7J0EW+OKIwdS930U9PiUf2q9RZ1BTQVJQhgP3atxTJW+5namVyom3RtxM6R5O3NvBgUZkXLS7H+CR/GbdtSg5ejAvhqg/pH8Jj5Tct0cjGmt+Q== 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 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CO6PR10MB5538.namprd10.prod.outlook.com (2603:10b6:303:135::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.20; Wed, 30 Mar 2022 23:31:46 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::b1f2:a803:163b:aad5]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::b1f2:a803:163b:aad5%4]) with mapi id 15.20.5102.022; Wed, 30 Mar 2022 23:31:46 +0000 From: Indu Bhagat To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/3] Refactor and update CTF testcases [PR105089] Date: Wed, 30 Mar 2022 16:31:35 -0700 Message-Id: <20220330233135.1762317-4-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220330233135.1762317-1-indu.bhagat@oracle.com> References: <20220330233135.1762317-1-indu.bhagat@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR03CA0205.namprd03.prod.outlook.com (2603:10b6:303:b8::30) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bb345de3-4b38-4d3e-803e-08da12a574c4 X-MS-TrafficTypeDiagnostic: CO6PR10MB5538:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d3uBb59hIMKf5KwtABWbHvFvbx+ijqLPBqqBPt3nBWUC7FTxB3AzAThSDRyT+JFrrwZgrny6MD1Aw3f6YekGBiWFSvEkjjRBsWB7D1ePSARjDdcDu+E+U5A7LWJyIzgIdC36zSJaWKp4fbGvr/zQJntkAsAhGX09XsgpbKwtVcxBYVW3WtSDwTgwnaYNE6CvQ1jyorGf/eJsPm6v49uud5PjjfRfCR2xAB8inMyaYVn0usBzx1bkoUD4nHpnJngY6q/ezDma2jVCpSmSOpYLs2Ia7AvZw866eigy+0k5uwO+4ahhEywpoVRRtXHiTVSodjdJx8ZcnQ/G8D9LUaaIV4hxAhTKiAUY1KnHc5rV+7QfryJLNEaPftVS9+SZ/EMLR6IokfxhRoSDSWP2WNxSagmRdLFtr6Xbf6h5ry0brxuiL0/bc1Q/vhXuV4vuuka6UP9oThMquLXbvvwVAGYIY5vfsr2PETDNYpMaQt+CCf6ThY7FKG1Ujlal8Ys1c7kKony+r8distANXvIXANZzZPUkN1kTqFArD+0IpgrvmXiHS/w3pruMx3xF/oMA/rKskEiqdBf9DrVKN5igd0GmoRXNZRh7QEpQf4IQw4I3dVZnkxaIdsM81x0SQMX+xlaKtuJI7JMO1hyC/rSKkTZ/KyTMb5Njl+2xhjJb3Y24i3y38cuyHqibcnB/6kAWA/vOPQv3OwjtlS2W9LbZsqvHUUr3vycoxAWgWOEy6KQDSqvgnjyDYoOI+yVFKld/xxVmmL3VRDL9n+fLNK1RGJtmMKXeU+c+8mTbt+qMiLG+M7Ph4MMjCOGLKOEyKMSu1+0vmIRUjxmbaTv2rmRSGuHlZg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(6512007)(316002)(52116002)(6506007)(186003)(1076003)(36756003)(6666004)(83380400001)(86362001)(26005)(2906002)(6916009)(84970400001)(38350700002)(2616005)(44832011)(508600001)(6486002)(5660300002)(66476007)(66946007)(66556008)(8676002)(38100700002)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?MNbkcQZzDHmACrW85OCUdNYwG/jxXifLW7e3iTTaHqnF3V21bJHt9ATIMiRP?= =?us-ascii?Q?Z7z3GtvVT0s/aWbJIRiF+JXI8EYJam9RIdyv6YTFy4gYHv/AThQ0/sfReG1g?= =?us-ascii?Q?BpENnQzj9CSXq2tHu+0YltdHkHrJtaRkm9gyVvIaQtExCAeJM5T/0n0XgOuR?= =?us-ascii?Q?f/tJPK0ZQckJ2HzKcF/o7/nbXVc2Mh99Vk3mRJUOptez2LptpByQXzkEwaGq?= =?us-ascii?Q?KsPC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?= =?us-ascii?Q?0Tsoj31AioK2KByQ9t3xSKRQxrrmQadbGoZpOLcfL4qVxDLVvf8c4LrY7rJ/?= =?us-ascii?Q?z/Xe0oP/bwQ3X8ZZl/ibnxiFD34ruT8Wn4dDuXU81T0oiJOmYIJL4Pp76JfQ?= =?us-ascii?Q?B/hGkWcDm5jH+Lg7o7Hsir7rJKc/+MjJ8QCOg+TyViwD7S333eMa24jUX4jA?= =?us-ascii?Q?LSeATiXCr1QT7PO4DvYF56ET6WWbPZDPbu5BfMohi5ZuDRPxt19nBJpI+70F?= =?us-ascii?Q?UtXYcmc6WEFjYGzUuHH2dzXoDNqgNIAUs5UhYpDjwIB/JfkpBt37mCiqoyuX?= =?us-ascii?Q?LIOiyh968Bnd35hjBCIBHiaeZH6ywn3RBJaF2+udnbsGJEyrYiHRt7QR0FDg?= =?us-ascii?Q?kmJHD9D14hUGeOX6WTTdnzKWpYZ/VGPLKvoOf5riwqqWnAv88wgb1mUPywTN?= =?us-ascii?Q?n8EHZyf9H/nEHQ/8cJqh0gXYhGXLBYsXuzC1ut3a6uZfevsEHQy7oypbV9cP?= =?us-ascii?Q?jnvF2A6N3Rhu1QCzn3e5jFpGLS3xa/nT3Hrplrps4oIOAOwBZb2Ynnpfn7VU?= =?us-ascii?Q?gBAt8GYA5Gllg1IKUZUgnVExC8VoGiFT/+RLijKEJ12tEDeIC0Glj4/uFFYb?= =?us-ascii?Q?izugCY3bDA=3D=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb345de3-4b38-4d3e-803e-08da12a574c4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2022 23:31:46.6160 (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: Wxt1gAnL9KomcQtA2cBRceA+XEq31EmieL3i3/0bnck8b5IN+bE+5yIupUzcDKzN11kFLtVgq5998UhNYGWp6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5538 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.425, 18.0.850 definitions=2022-03-30_06:2022-03-29, 2022-03-30 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203300112 X-Proofpoint-ORIG-GUID: -dNEUhNaH5PcLf2OGO4uKy_ZNDnb5O1_ X-Proofpoint-GUID: -dNEUhNaH5PcLf2OGO4uKy_ZNDnb5O1_ X-Spam-Status: No, score=-13.5 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2022 23:31:53 -0000 This commit splits the ctf-array-2.c into ctf-array-5.c and ctf-variables.c with the following responsibilities: [1] ctf-array-2.c: Test CTF generation for unsized arrays. [2] ctf-array-5.c: Test CTF generation for unsized but initialized array. [3] ctf-variables-3.c: Test CTF generation for extern variable with defining decl. Earlier all three tests above were being done in ctf-array-2.c. Further, the checks around [3] were very loose in the original version of ctf-array-2.c in that the testcase was only checking that the types are as expected. The compiler was emitting two CTF variable records as follows: Variables: _CTF_NEWSTR -> 5: const const char [0] (size 0x0) -> 4: const char [0] (size 0x0) _CTF_NEWSTR -> 8: const const char [8] (size 0x8) -> 7: const char [8] (size 0x8) This is incorrect behaviour as it creates ambiguity. The testcase ctf-variables-3.c now has added checks that only one CTF variable record is expected. 2022-03-30 Indu Bhagat gcc/testsuite/ChangeLog: PR debug/105089 * gcc.dg/debug/ctf/ctf-array-2.c: Refactor testcase. Move some checks ... * gcc.dg/debug/ctf/ctf-array-5.c: ... to here. * gcc.dg/debug/ctf/ctf-variables-3.c: ... and here. Add additional checks for one CTF variable and one CTF object info record. --- gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c | 22 ++++++------------- gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c | 17 ++++++++++++++ .../gcc.dg/debug/ctf/ctf-variables-3.c | 22 +++++++++++++++++++ 3 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-3.c diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c index 2a19da050fe7..4721c4fb2f97 100644 --- a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c @@ -5,34 +5,26 @@ TBD_CTF_FORMAT_OPEN_ISSUES (1) - This testcase makes a note of the case of a probable misrepresentation. - See Note 1 and Note 2 below. + See Note 1 below. In the CTF section, these types are encoded as : Variables: - _CTF_NEWSTR -> 7: const char [0] (size 0x0) - _CTF_SECTION -> 6: const char [5] (size 0x5) - b1 -> 2: int [0] (size 0x0) - b2 -> 3: int [0] (size 0x0) + b1 -> 3: int [0] (size 0x0) + b2 -> 5: int [0] (size 0x0) Note 1 : There is misrepresentation in that b1 and b2 are specified differently by the user. - Note 2 : It is arguable though whether the representation for - _CTF_NEWSTR is incorrect. */ + + In this testcase, two CTF array records each of type int [0] is expected. */ /* { dg-do compile ) */ /* { dg-options "-O0 -gctf -dA" } */ -/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 5 } } */ +/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 2 } } */ -/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*cta_nelems" 3 } } */ -/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*cta_nelems" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*cta_nelems" 2 } } */ static int b1[] = {}; int b2[0]; - -const char _CTF_SECTION[] = ".ctf"; - -extern const char _CTF_NEWSTR[]; -const char _CTF_NEWSTR[] = "ctfinfo"; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c new file mode 100644 index 000000000000..ec504412ef56 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c @@ -0,0 +1,17 @@ +/* CTF generation for unsized (but initialized) arrays + + In this testcase, one CTF array type record of size 5 is expected. + + Variables: + _CTF_SECTION -> 5: const const char [5] (size 0x5) -> 4: const char [5] (size 0x5) + +*/ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*cta_nelems" 1 } } */ + +const char _CTF_SECTION[] = ".ctf"; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-3.c new file mode 100644 index 000000000000..8aea1e82749e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-3.c @@ -0,0 +1,22 @@ +/* CTF generation for extern variable with defining and non-defining decl + in the same CU. + + This testcase checks the case when a non-defining decl is followed by + a defining decl for the same variable. See PR debug/105089. + + In this testcase, although two CTF array types are generated, only a + single CTF variable and a single entry in the CTF object info section + are expected. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 2 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*cta_nelems" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x8\[\t \]+\[^\n\]*cta_nelems" 1 } } */ +/* { dg-final { scan-assembler-times "ctv_name" 1 } } */ +/* { dg-final { scan-assembler-times "objtinfo_var_type" 1 } } */ + +extern const char _CTF_NEWSTR[]; +const char _CTF_NEWSTR[] = "ctfinfo"; -- 2.31.1