From patchwork Fri Dec 20 19:03:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1214284 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-516393-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="X9SAk51F"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="NKSlLtb2"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47fdTF169Lz9sR1 for ; Sat, 21 Dec 2019 06:04:15 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=Zi/MfgjX8kaQbFZX Axis2CTg5z9U3HFP4RKIisOkdvp+1G7A28hQ1NAH3pqIcWLX7WwVo+43pLvmtL/3 ZjjuGdkP+tY1H+ZrASFDxn4clGMV3QsszUx0hWW4d9XpC4wYCyrS1GcKguaGYFlw uE5aVCU/RofdI5XFO+2re1gvDjE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=O98u904aHlxOG/GJ9oXwZy N7WUQ=; b=X9SAk51FrU6bbzY0hKv3yyeI9dl8m/R283edmxTXAt0+Lh/hrR5yOC mC2YtrM5zy69OBuoHgxzYfJBGJIk6uuDp0G/nlB6KqlsXQtK0UnTogs1WDHDRMbv 8MKceSWVFkvgGNO91UJj/5OMH4/VabArn/WITeYMLey3ttxbctpnY= Received: (qmail 74979 invoked by alias); 20 Dec 2019 19:04:07 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 74969 invoked by uid 89); 20 Dec 2019 19:04:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1808 X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Dec 2019 19:04:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576868644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JFohp+qegmSiGCdXavVA+GNrsItob3sjMmXHtww7V+0=; b=NKSlLtb25ZFDmJTgegDN7WtGn2t6NtL50idbW/QX9oxlxSME5geWQGY1UqINFdN7h+fvdQ kCP195Dhp/0u7Fz8wp4q42GGwa58eMX4awCwSX/EIh6KSOGIhtsRAyahZULbo+WFQ3ppPp XH0Q07fqDlUMG5XIyr1XlPNFWy+7X/I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-189-VjefhHrGPomTM5EH7vkTvA-1; Fri, 20 Dec 2019 14:04:03 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4EBC1DB61 for ; Fri, 20 Dec 2019 19:04:02 +0000 (UTC) Received: from t470.redhat.com (ovpn-117-41.phx2.redhat.com [10.3.117.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEA071CB; Fri, 20 Dec 2019 19:04:01 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 1/2] (analyzer) tree-diagnostic-path.cc: properly handle ad-hoc wrappers of UNKNOWN_LOCATION Date: Fri, 20 Dec 2019 14:03:56 -0500 Message-Id: <20191220190357.28704-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-IsSubscribed: yes In the reproducer for PR analyzer/58237 I noticed that some events that were missing locations were also missing text; for example event 3 here: | 15 | while (fgets(buf, 10, fp) != NULL) | | ~ | | | | | (2) following 'false' branch... | 'f1': event 3 | |cc1: | The root cause is that the path_summary-printing code doesn't consider ad-hoc locations when looking for reserved locations, and so fails to detect an unknown location for the case where an unknown location has been wrapped into an ad-hoc location to record a block. This patch fixes the issue by using get_pure_location, thus looking through ad-hoc wrappers, improving the result to: | 15 | while (fgets(buf, 10, fp) != NULL) | | ~ | | | | | (2) following 'false' branch... | 'f1': event 3 | |cc1: | (3): ...to here | Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to the dmalcolm/analyzer branch on the GCC git mirror. gcc/ChangeLog: * tree-diagnostic-path.cc (path_summary::event_range::print): When testing for UNKNOWN_LOCATION, look through ad-hoc wrappers using get_pure_location. --- gcc/tree-diagnostic-path.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-diagnostic-path.cc b/gcc/tree-diagnostic-path.cc index 243f05a5fb14..32dc054519b7 100644 --- a/gcc/tree-diagnostic-path.cc +++ b/gcc/tree-diagnostic-path.cc @@ -172,7 +172,7 @@ class path_summary In particular the label for the event won't get printed. Fail more gracefully in this case by showing the event index and text, at no particular location. */ - if (initial_loc <= BUILTINS_LOCATION) + if (get_pure_location (initial_loc) <= BUILTINS_LOCATION) { for (unsigned i = m_start_idx; i <= m_end_idx; i++) {