From patchwork Thu Oct 6 19:50:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1687162 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Ge+hJJ2M; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mk2BJ2zGQz20Pd for ; Fri, 7 Oct 2022 06:51:20 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6530438983A3 for ; Thu, 6 Oct 2022 19:51:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6530438983A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665085878; bh=J4CwlU0lTWrmBr2qYk+iwAoArE7JBADoFAxtc87dWSM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Ge+hJJ2Ml073Ov5/Xtz9GjMZa8DdBYZU4M1tNb4pJq7KScuu0mOl14YgEU9PqcVA/ okIBKyULT6bVzICLDaz0KOZ7USBP51xLZsIxImBClq/7CM7iqXg8qnEh1chSPaUSP/ MO9v9JNVZGY2DAIw/aWv/lvTPSWOl2KnoZeLEgQY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 5DEEF3898383 for ; Thu, 6 Oct 2022 19:50:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5DEEF3898383 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-592-0dxXSe0VPpWl-TikM1KSPA-1; Thu, 06 Oct 2022 15:50:52 -0400 X-MC-Unique: 0dxXSe0VPpWl-TikM1KSPA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 63842811E67 for ; Thu, 6 Oct 2022 19:50:40 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.2.17.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D109405D4C0; Thu, 6 Oct 2022 19:50:40 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [committed] analyzer: fixes to call_summary_replay::dump_to_pp Date: Thu, 6 Oct 2022 15:50:38 -0400 Message-Id: <20221006195038.807580-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: David Malcolm via Gcc-patches From: David Malcolm Reply-To: David Malcolm Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r13-3137-g30d6356773a838. gcc/analyzer/ChangeLog: * call-summary.cc (call_summary_replay::dump_to_pp): Bulletproof against NULL caller regions/svalues. Signed-off-by: David Malcolm --- gcc/analyzer/call-summary.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/analyzer/call-summary.cc b/gcc/analyzer/call-summary.cc index bc50562b5ec..12ef82d18d6 100644 --- a/gcc/analyzer/call-summary.cc +++ b/gcc/analyzer/call-summary.cc @@ -845,14 +845,20 @@ call_summary_replay::dump_to_pp (pretty_printer *pp, bool simple) const for (auto summary_reg : summary_regs) { pp_string (pp, "reg in summary: "); - summary_reg->dump_to_pp (pp, simple); + if (summary_reg) + summary_reg->dump_to_pp (pp, simple); + else + pp_string (pp, "(null)"); pp_newline (pp); const region *caller_reg = *((const_cast (m_map_region_from_summary_to_caller)).get (summary_reg)); pp_string (pp, " reg in caller: "); - caller_reg->dump_to_pp (pp, simple); + if (caller_reg) + caller_reg->dump_to_pp (pp, simple); + else + pp_string (pp, "(null)"); pp_newline (pp); } }