From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 53F0B3854800 for ; Wed, 30 Jun 2021 19:35:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 53F0B3854800 Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-207-BzmI8YbPOsWQ_eCSGv-UeQ-1; Wed, 30 Jun 2021 15:35:07 -0400 X-MC-Unique: BzmI8YbPOsWQ_eCSGv-UeQ-1 Received: by mail-pl1-f198.google.com with SMTP id u15-20020a1709026e0fb0290128b23b05c2so1611022plk.4 for ; Wed, 30 Jun 2021 12:35:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9lC7cmZ5ZKdX9qUr1FELvmVqjx65DjWq91Utp+8wWzE=; b=IE68cDmKri/2JAuHS+qwWEbThtED0oG6nw+nfu2vJh+zZ3CEopRq9Kh6SY7Nc+mmdt dLEuVddZr1JY0apRCSMMTrRsjSarZB8DgNGimIhLBY++y0YAsu4UtIaIAqMT9bxPbSza jKI+GzHmOHL7WkAletuipQ00vhqh6m+mOTVPCjiqGgzwv7r1AMzq5mVX9a9qu8zdwHjd kjuG4gqsKDQ6LXKxPGrkXI9wY7OhduO51djs51Vbh4CgOasqMe3Ah5dHVHLKW4QYLeYQ 6OZqAlnG5aGYf2HGZfWQCOD35E3dSSLPGbTX8wP3PtNeGge6KjMbuSeParMiMUg9+TlC YdPg== X-Gm-Message-State: AOAM532Wbs1cUNlQZu1x55jp208Vq2GSw1//WTnaN8a6Tde0wdU5vhIh sgkcgJYVlW0rkk0W1ni4W5iltwdlNKlsFP0AsWcOXx013OHY/8e0Yzzb7nDz255w0y5neZxr5JK 6ZeKO0Okzgvh39i6kkCi7ZqjQS2rOEFydqw== X-Received: by 2002:a65:4009:: with SMTP id f9mr4131295pgp.148.1625081706953; Wed, 30 Jun 2021 12:35:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5uAzteBFGoRYdRxGnqg/am9HM9ixR9YGLyc/WZ/6BRNssUrXAvl/x4i9beS84MwfNEwj/wSEENzTd+2ChVwo= X-Received: by 2002:a65:4009:: with SMTP id f9mr4131269pgp.148.1625081706610; Wed, 30 Jun 2021 12:35:06 -0700 (PDT) MIME-Version: 1.0 References: <20210630053529.26581-1-tbsaunde@tbsaunde.org> <20210630053529.26581-2-tbsaunde@tbsaunde.org> <907daf69d72fedce3dd9ee8a9dccc59d7d22a08a.camel@redhat.com> In-Reply-To: <907daf69d72fedce3dd9ee8a9dccc59d7d22a08a.camel@redhat.com> From: Jason Merrill Date: Wed, 30 Jun 2021 15:34:55 -0400 Message-ID: Subject: Re: [PATCH 2/4] allow poisoning input_location in ranges it should not be used To: David Malcolm Cc: Trevor Saunders , gcc-patches List X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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 Jun 2021 19:35:11 -0000 On Wed, Jun 30, 2021 at 11:14 AM David Malcolm via Gcc-patches < gcc-patches@gcc.gnu.org> wrote: > On Wed, 2021-06-30 at 01:35 -0400, Trevor Saunders wrote: > > This makes it possible to assert if input_location is used during the > > lifetime > > of a scope. This will allow us to find places that currently use it > > within a > > function and its callees, or prevent adding uses within the lifetime > > of a > > function after all existing uses are removed. > > > > bootstrapped and regtested on x86_64-linux-gnu, ok? > > > > Trev > > [...snip...] > > > diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c > > index d58586f2526..3f68d1d79eb 100644 > > --- a/gcc/diagnostic.c > > +++ b/gcc/diagnostic.c > > @@ -1835,7 +1835,7 @@ internal_error (const char *gmsgid, ...) > > auto_diagnostic_group d; > > va_list ap; > > va_start (ap, gmsgid); > > - rich_location richloc (line_table, input_location); > > + rich_location richloc (line_table, UNKNOWN_LOCATION); > > diagnostic_impl (&richloc, NULL, -1, gmsgid, &ap, DK_ICE); > > va_end (ap); > > > > I actually make use of this in the analyzer: the analyzer sets > input_location to stmt->location when analyzing a given stmt - that > way, if the analyzer ICEs, the ICE is shown at the code construct that > crashed the analyzer. > C++ template instantiation and constexpr evaluation work similarly. Jason