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 5AEE73983803 for ; Fri, 2 Jul 2021 15:46:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5AEE73983803 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-105-uJZ9X41rN76Bbxlyn6AO_Q-1; Fri, 02 Jul 2021 11:46:49 -0400 X-MC-Unique: uJZ9X41rN76Bbxlyn6AO_Q-1 Received: by mail-qt1-f200.google.com with SMTP id a12-20020ac8108c0000b029023c90fba3dcso5915786qtj.7 for ; Fri, 02 Jul 2021 08:46:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=aAeE3C8H3Q7cFWdraF0Is/HN09EPfy68sL3xsfMM46M=; b=R0ihFHwMPC02cUG3OoqKfoZzGQV0tC8ojOs9SvAAJm0FN4ynaD3YGW03CJT11sBXEB V4LAa1bKRsCJavPo2jmlU/iNHvphsYyfwuQpp2+8Yw/2CjXHLyqcNjNis63vcr2rW+gT Y4WC7hF0AqbEUZvL2lNetPzPJfDQiZ/BA6QSUmkM2pJi1u7FPnnEOsDbrFI56WmJVyrY nl8UDFECbPwPgctQtby59nMeCFo3czEkimpIOWyc3KeaAH3/42yyAYjM72uDWZbd17jL tDkJT8jOO36WRCWV1JWrLePI6ftN0BDIK1MD9ZbSO8GDT3xTen3/S6NNG+jvzsG2RjHU sESQ== X-Gm-Message-State: AOAM533qkvQ5wcUrOspolU84GkeE5FthTNSvETqoATZBR3ZRb0b1SrTq Cx190ZZ2KOP8AwBEJKi8I410ut3/9uZDcctUFBeJd9/OIBKHcj2g9iG55A8nM1ISGhLjm6uR02u u+CtMEAS7NUoWtXkw7pn5Rmq03XzizqdC2NrBpfXi8Q0r58QmNbRZp6YxQm63+SYJiA== X-Received: by 2002:ac8:67d9:: with SMTP id r25mr323703qtp.111.1625240808344; Fri, 02 Jul 2021 08:46:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXH/0TH/8lJ0ayl+nMZ4Q05JqNHHIAQNaxJvOC8suhmA2nt1/GL2kglcFMrFQ8+AjNK0hd4w== X-Received: by 2002:ac8:67d9:: with SMTP id r25mr323678qtp.111.1625240807964; Fri, 02 Jul 2021 08:46:47 -0700 (PDT) Received: from [192.168.1.148] (130-44-159-43.s11817.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id x14sm100058qta.90.2021.07.02.08.46.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Jul 2021 08:46:47 -0700 (PDT) Subject: Re: [PATCH 2/4] allow poisoning input_location in ranges it should not be used To: Trevor Saunders , David Malcolm Cc: gcc-patches@gcc.gnu.org References: <20210630053529.26581-1-tbsaunde@tbsaunde.org> <20210630053529.26581-2-tbsaunde@tbsaunde.org> <907daf69d72fedce3dd9ee8a9dccc59d7d22a08a.camel@redhat.com> From: Jason Merrill Message-ID: Date: Fri, 2 Jul 2021 11:46:46 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, 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.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: Fri, 02 Jul 2021 15:46:51 -0000 On 7/1/21 6:16 AM, Trevor Saunders wrote: > On Wed, Jun 30, 2021 at 11:13:23AM -0400, David Malcolm 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. >> >> This behavior is useful to me, and would be lost with the proposed >> patch. > > I made this change because otherwise if the compiler ICE's while access > to input_location is blocked we end up infinitely recursing complaining > we can't access it while trying to say where the last error was. I was > nervous about the change before, and now I agree we need something > else. How about allowing a scope (like internal_error) to explicitly un-poison the variable? Separately, all the location_t (input_location) changes are pretty clunky, can we make that conversion part of the macro? Jason