From patchwork Sun Oct 16 20:24:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugene Rozenfeld X-Patchwork-Id: 58925 Return-Path: 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 C01923858C74 for ; Sun, 16 Oct 2022 20:25:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C01923858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665951928; bh=Sg3IhglBnJ/Y8oRHCSe0aQF9sTIkTOxurVYYwK6EHxo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=i2WlabmvkRORk98LpJHTMvwuAOUDOwWgLhS+EeTKNSv0q1cB0vmWYMq4CnVzYT/Hk AFV04TjCc9U9FkTywQk2JXrgSsEvgEC5Wli75Y1x0fv64i+1NnQn32qfGMEAoDEu2W Ww2A0bLxj91yMoAIQWLFWk1mBi5wknf9gZc3nOTg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from na01-obe.outbound.protection.outlook.com (mail-eastusazon11020020.outbound.protection.outlook.com [52.101.51.20]) by sourceware.org (Postfix) with ESMTPS id 4CCD93858413 for ; Sun, 16 Oct 2022 20:24:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4CCD93858413 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kQkr3icrqFZnrWcNlFQJGa7efHJjk0YQ5yMQdD4nxQnZQNe4VHRjKTjb+OggeCD24i4rDT3wfNRs6XUoKVfTIVjdFebvy+9jUqu6IEEyk1Aoe464xFS2AHKJpj7yIRmGX6RhmnkwoUDGRrd/OI0xFv6NSqJF9YtZOOgM++NhyKNbe2YTS7KMLa5k9iWqq2p8DPVtYIUogqtTJcnO8hIq/x8qFwiqp87bm3S+IqKDT33NwNVBOgDZDnrrpxxhcj0510H28AiqLqJBRxiatj+rutm+IqwerPfusOML0u/wGwRwGuMdEUtbsvaoKM6RcD+d3jMnvCq3BnhkrMz3E6HSgg== 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=Sg3IhglBnJ/Y8oRHCSe0aQF9sTIkTOxurVYYwK6EHxo=; b=mpCxCLETbo1JlTxwlT94vQ8i7vMG6+8DKvDNZHOqOt01NTIaeGbethuPntztksvsB5MBowa4XgAafTcFVDOaAwzwhNNshxPlbTaeFc6JQgMRipf+KBHsAH+Dh+UMTaS27xLCDkNsa6OcjSNq7AbonnfjKRB+NzOb2kR8v42lEhFR1fY6ESQwIxU1aRYdN0tX4sqeTdhWyKq6qO3lp2QXoe4PoljHgzhYlXUKQ5mujg5qEGNSjlZIcqOAJ2HJCa9BH3Pg0W/FzSujwlm686uEO97uqL7Q0nKjDQnRkJDEU9diompE/LyzPcUHx/VLwziT3iBrPDu/NjIafm+4Y+p2kQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none Received: from CY5PR21MB3542.namprd21.prod.outlook.com (2603:10b6:930:d::7) by DM4PR21MB3610.namprd21.prod.outlook.com (2603:10b6:8:a2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.6; Sun, 16 Oct 2022 20:24:53 +0000 Received: from CY5PR21MB3542.namprd21.prod.outlook.com ([fe80::ff72:1a2:7c8:1b55]) by CY5PR21MB3542.namprd21.prod.outlook.com ([fe80::ff72:1a2:7c8:1b55%7]) with mapi id 15.20.5746.015; Sun, 16 Oct 2022 20:24:53 +0000 To: "gcc-patches@gcc.gnu.org" , Jason Merrill Subject: [PATCH] Don't print discriminators for -fcompare-debug. Thread-Topic: [PATCH] Don't print discriminators for -fcompare-debug. Thread-Index: Adjg+x91bYI9Uh2kSX69tWF/1EUr3A== Date: Sun, 16 Oct 2022 20:24:53 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=32d52412-badf-4e55-abab-a29994e9b759; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2022-10-16T01:02:36Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CY5PR21MB3542:EE_|DM4PR21MB3610:EE_ x-ms-office365-filtering-correlation-id: 69cd39f4-d888-49e1-b003-08daafb47be9 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WAJ2Mio3qqd6nJzDcPquVwosdidoDbJ61IQtbo8r9LaMn4Ozjr8KdkF/5OFyti4bTgdRUpDs0UJzWv/X1G9AoTsxNXdFOwUpxepS/8ppAhldmx9DKggicWEt4j1j+ZE1kgAa3T7wnXSXGX2+3paVROabydnqUUqKrudSLtgDElIIU+GuJ74wyNi584dqUq908Y4yHIUAtL68f6/hYeYn+9XFRmf8GDa3j5TPZuZXujvspbuVW4lqupy12nnMgwsNvW9GM2qbV37GFnt+YytgtMc6YzcQ49tjP2i3w7bf4DTHIOzBs8HRTgsOZnZ3uhc0TiC5s/xXngzH3IPEaVyvUXsZ9NBuIDFCoF/knhN8fOR6WHLVnfmsEcyIw3AXqqQkOkzkGHmQQJUVnm5kRwD5a9WkEIvUArVXS17d+ruz68qdrUr3Vo0iZskF22BQGxOhvaYlXcY/BOJUlp7ij8DqW6YetsCyzaWrg0rRAdJ0ntBNHJCzRgMG4zjbcaUVAZMs+75CdaRqwj3c41N8Z3GSXXrYfJ7MvgDpTrctL/7MJtznCPNGwHbUdw5T/cRd3kLfCVKPOBHCzYOuNPXHM9E+vI5or3LaIq/8gFgnVRvvn2HRvbug9GwK3ZAB7TpXWXGwARgLfr5jstCVYuYwWX4YmfUULwLC03EHcdNM9fgTY8Es0F9CVO+9AFIxIFgPJ1zzG+5ksDljTlMxLh1zm2m2DQ6ZuWgieU+bibonEAB+wKZ+IN2XMpvPpCUNNmqK46dcX9pQDjM8v2t7ZUwHDsUrT8R3W/TAb1V7D8BBfm/DUM7ffqbJ44aEo8YSfE//n035cUnoHIttV+UwJ3alVTM4tg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY5PR21MB3542.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(396003)(376002)(366004)(346002)(39860400002)(136003)(451199015)(2906002)(38070700005)(5660300002)(8990500004)(55016003)(82960400001)(82950400001)(52536014)(38100700002)(8936002)(122000001)(41300700001)(8676002)(66946007)(66446008)(66476007)(76116006)(66556008)(64756008)(83380400001)(186003)(316002)(110136005)(86362001)(33656002)(10290500003)(7696005)(6506007)(9686003)(478600001)(966005)(71200400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: YfNsoaFLWb/5+2h+6KPsrMT8jn4cR2xwqlegnQBU4jw1L+ldauv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6gAuYwXSW/J7fJB6TaogoNYk9kCG3GNUtcFTAor9zkkcIi1oJIJ6hqWzjnFW4k7JWTPrTxblCJvpkda1xF1QdRBWGQ+TOseffaxG7IBxi1Oj1jhwEMB6BTOs8xs6HNlwPnYaERLX99GGyS4emZSwEXJArMoSZzYkt/LkC7uMORxeBX3dcG1DW0w7Oyc5tJXP/uwWKBI/CWsAaHjBi+efEKAbpH9efwyM+cJbccUssx6tsw8qo/lknkBWDPA2HLTRwV88hVy93hcGJk9lvvxdF1EskHR/aZjV3/eY7TAwL5zOZBSfmhbcUy19dHfkCAIaSR8vxzanNikudM8g/wuQ0AreO9bSO3QyFRKRSOkMGdh+X2as3Cb5JYjz5gxqa3QyH8AjtFavryVj1xZnPFHAbIaJCmpswcraNhmiX3+FGAp+X2vsXT5aQDl72gDfgQfP58YYSSrTB1586PJ0/m1G3L03/uWsG7BQe9cmDSD3nvIHM+DZ9eOFaGYw2Sf4XjgiUk33SgxouQDqw6Mw9B1 MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY5PR21MB3542.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69cd39f4-d888-49e1-b003-08daafb47be9 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Oct 2022 20:24:53.3920 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: AnFpXX7iMu94Sa99dJSDsnMhP3GcFuEH/7VM6D71oDeLUL9VKZEXUSVqiqscceyQw1GmkqQYSIVOda05VDzLlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR21MB3610 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Eugene Rozenfeld via Gcc-patches From: Eugene Rozenfeld Reply-To: Eugene Rozenfeld Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" With -gstatement-frontiers we may end up with different IR coming from the front end with and without debug information turned on. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100733 for details. That may result in differences in discriminator values and -fcompare-debug failures. This patch disables printing of discriminators when the dump is intended for -fcompare-debug comparison and reverses the workaround in a test. Tested on x86_64-pc-linux-gnu. gcc/ChangeLog: PR debug/107231 PR debug/107169 * print-rtl.cc (print_rtx_operand_code_i): Don't print discriminators for -fdebug-compare. gcc/testsuite/ChangeLog: * c-c++-common/ubsan/pr85213.c: Reverse the workaround for discriminators. --- gcc/print-rtl.cc | 13 ++++++++++--- gcc/testsuite/c-c++-common/ubsan/pr85213.c | 7 +------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gcc/print-rtl.cc b/gcc/print-rtl.cc index e115f987173..0476f3d7e79 100644 --- a/gcc/print-rtl.cc +++ b/gcc/print-rtl.cc @@ -453,10 +453,17 @@ rtx_writer::print_rtx_operand_code_i (const_rtx in_rtx, int idx) expanded_location xloc = insn_location (in_insn); fprintf (m_outfile, " \"%s\":%i:%i", xloc.file, xloc.line, xloc.column); - int discriminator = insn_discriminator (in_insn); - if (discriminator) - fprintf (m_outfile, " discrim %d", discriminator); + /* Don't print discriminators for -fcompare-debug since the IR + coming from the front end may be different with and without + debug information turned on. That may result in different + discriminator values. */ + if (!(dump_flags & TDF_COMPARE_DEBUG)) + { + int discriminator = insn_discriminator (in_insn); + if (discriminator) + fprintf (m_outfile, " discrim %d", discriminator); + } } #endif } diff --git a/gcc/testsuite/c-c++-common/ubsan/pr85213.c b/gcc/testsuite/c-c++-common/ubsan/pr85213.c index e903e976f2c..8a6be81d20f 100644 --- a/gcc/testsuite/c-c++-common/ubsan/pr85213.c +++ b/gcc/testsuite/c-c++-common/ubsan/pr85213.c @@ -1,11 +1,6 @@ /* PR sanitizer/85213 */ /* { dg-do compile } */ -/* Pass -gno-statement-frontiers to work around - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100733 : - without it the IR coming from the front end may be different with and without - debug information turned on. That may cause e.g., different discriminator values - and -fcompare-debug failures. */ -/* { dg-options "-O1 -fsanitize=undefined -fcompare-debug -gno-statement-frontiers" } */ +/* { dg-options "-O1 -fsanitize=undefined -fcompare-debug" } */ int foo (int x)