From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by sourceware.org (Postfix) with ESMTPS id C319C3858D39 for ; Mon, 17 Oct 2022 07:05:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C319C3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x52d.google.com with SMTP id l22so14667800edj.5 for ; Mon, 17 Oct 2022 00:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=hsn2rW3mqUAOuA5BGiDhJL2F/dShu850wJlse4i9qGw=; b=MtQtMPFUUGT/7tzQ1N02Gy9xP5tHEPbTq3wVlu34JZfEQXmpfiDLiAWxFqdFLJ3quB fOMac3eQpJistNGCl1N6GFe0X3V1LZfQzKebNdnE5TAHeKMKZTFepTBUMz6CGM39XC2F cBe3KIKIXQ7lXJAIQai9XLpy0FNnUSdCnDotK1CG/w5BaKgezumxhovJ01fU9CF52j4B EqF2kaZzUiLkgmxQSKTGVkd81ZHSD+3Z5j83ldkljpTRj7BtQNpW4lEDLZT9584FjTHO sFvmdzQppX9G2hQR6eaagh+humma4tWt2c0ypjZ01ocZ2rVmIi2rPq4EVfovYoTzPz/Q FI9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hsn2rW3mqUAOuA5BGiDhJL2F/dShu850wJlse4i9qGw=; b=xCNms4RZtApoh0QSGUhqFckKM/TGRaDfOSHBZZCyxX8CvvTFw3vWAXADu2u4mUU7zm BKkfY4KQCHL5xVj9BjE2HxfR2kQcaK/9XIc4z+jjhMx/TmA1Dc9dnoZTZ8O7/InGi+W2 efHkWDA0n6z0NWFoUVPCo7aGfIYLsMIHKNTnSzu9HMhpYFENxsOXxy4a+xpvozUUZBiS OgNvGvwtBcTwxve7G6E4hAtiq6y7DicCqhKi/Tshu+Q6QioimabTG0yYu+kyhj/5zaX+ CH+OebOdNffgpdkFZ5LlYFH5sFcyHu06jki0IjVanbKLUNgee0DttkaBTTpzRXsK+X4D Jf/A== X-Gm-Message-State: ACrzQf1yMa6Sp/A2XU4pfIqbEMA8nmAoZq1U40qCWubuD4NTtNpzpKq8 LiTFgNkZA0WoAaKrOGaO7sIzPoEIVxWeIP09e68= X-Google-Smtp-Source: AMsMyM4wZ9rpurFbFXdfpAXUJG1DJUdIYDOOswhLHnJnxq3zYR6zfM/y2oDgXn6DGlq3jbAMm+hIC9QSqgCuT5ZabWQ= X-Received: by 2002:a05:6402:3508:b0:45d:4492:a885 with SMTP id b8-20020a056402350800b0045d4492a885mr8999490edd.250.1665990345095; Mon, 17 Oct 2022 00:05:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Mon, 17 Oct 2022 09:05:31 +0200 Message-ID: Subject: Re: [PATCH] Don't print discriminators for -fcompare-debug. To: Eugene Rozenfeld Cc: "gcc-patches@gcc.gnu.org" , Jason Merrill Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: On Sun, Oct 16, 2022 at 10:25 PM Eugene Rozenfeld via Gcc-patches wrote: > > 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. I don't think this is the correct approach. -gstatement-frontiers is known to be prone to these issues and is the one to blame here. I think the bugs should be SUSPENDED until -gstatement-frontiers is fixed or at least disabled by default (IIRC Jakub tried that but failed last time) > 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) > -- > 2.25.1