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: 1794 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp479684wrs; Thu, 6 Oct 2022 12:51:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4cI/rAQQIciaPCWrVDCNIDzkN3eHRKaXrRYejVK2j6gWfKkCczr61OmTAIR3fIQnvb9bxd X-Received: by 2002:a17:907:2cf7:b0:77a:9707:bb5b with SMTP id hz23-20020a1709072cf700b0077a9707bb5bmr1246964ejc.655.1665085916970; Thu, 06 Oct 2022 12:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665085916; cv=none; d=google.com; s=arc-20160816; b=FjphJhxzkaUBzBok57EwJbSyMHA/MVlQazhMTkzDkdYAYYiW25M3pT5CMORqJ0qGQ+ y9GpKyI4/lJVTK3aIDXAOZ8m+HGASvEUU6jT8SOpN0gfXi6zBlJTllo+z9ENrOQSvT/m 8bRYP5nX2ikDDUlifYnEqKAmz+DAcQHzyYdo/x+J/98p2XuwVGoHpYR/aihA9F5D0gkd OJlJWS/BfiB1hou+qOfAcynubjyJmumiPWe0U4tLFnOrrpzd2TKpQs/ZSp52o7FKSYrE WZ7yhJj95hWEH081StbTDWsyEz38VlxD5fKp2+Hi+8D0/3oz6W5IsN5VrsY1AHjq0cHf dfZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=J4CwlU0lTWrmBr2qYk+iwAoArE7JBADoFAxtc87dWSM=; b=hLS+k6NNergLS5VCvGKUjS9iV4x/ttTTlEyoBogHjI5fGCpzNb3FD/HEfHwVCtRlTz 7heuYgyR2fc7YYPWHCvxtbDcUYmCA14AbrJ3FgqRHKBO6D6k0kpyYL+gvlLShXfRkb8W FBfxfl5GBfBQn9q7uRd9d5UkoaV7y14EZg30O8see+m1d22O2lnJUZXM3r0JAyuohtJu L7tLvnXjAVj0BnCa7Qc2yhhR4Ys780KiJfxxC+GEGEDvKv1Yb1Ou/ZNnxjxzln+jwwA7 M4zc4VBebkeqVvKdPMWw4jmSS8EtwbiqcA3fBBN2dpg7HQAZDtQMEB/DQy/x8rshyt/u Bu1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=H1Q96DBG; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v7-20020a1709064e8700b0077ef2f9c8b7si178714eju.922.2022.10.06.12.51.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 12:51:56 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=H1Q96DBG; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8BA38384B80F for ; Thu, 6 Oct 2022 19:51:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BA38384B80F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665085901; bh=J4CwlU0lTWrmBr2qYk+iwAoArE7JBADoFAxtc87dWSM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=H1Q96DBGbL9hLtNHmA2FBzHnTLBqLSOgFUZ8hGLiNsry0EHZz9az5Qpys8fQC0oFv 4ej6nn8xKdS3Nz889zbnJTfw9UPsJtIzcrV3Ra2k64F7TD+i4Bmi3Z7GFjdeowYrAH 0ouppl0fwbg9atfGw7/G7irmi9izZ/vPt7Z2pO/4= 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745969130485703977?= X-GMAIL-MSGID: =?utf-8?q?1745969130485703977?= 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); } }