From patchwork Fri Aug 4 20:22:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 131340 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp81296vqr; Fri, 4 Aug 2023 13:23:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgaBokQpb94rak2W1regdWSuAtMnndIQlyk8PuQT3+ibQQFmQyHPILmBNtCQi4HLzQP27V X-Received: by 2002:ac2:58d6:0:b0:4fe:5654:9d00 with SMTP id u22-20020ac258d6000000b004fe56549d00mr1651794lfo.48.1691180580263; Fri, 04 Aug 2023 13:23:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691180580; cv=none; d=google.com; s=arc-20160816; b=IP2gHYQQWmKVcugEuWfJl4uci2Bd/3TtbqMlEF4+cfeXUPvgO0RzyxO33pODD74+tv j0cYoLVPXxl8n9v1hgPkUtr1OUFnwd2AplvOhgzezUWmY8rrIOjobWBjCSdafMrngSlA sQx8EoCByr2JxNyj08qPNVkrfHoR7FSVKRUZE7Dhpfi0FX6FmaRBS97wWnRZLLb/Cq6m CO5Jqjab6X4M1FfuOaxUgP7oDpfwC1gXvpgXgDJB6mZCm0YurDthEH2ZaUognsZxEoYN QMW2Wqy4mlPy66dkkPT/n8xBr3/wAEwT2zX5ZqmRREYnG0UyuYc3qGi7tD8ZjIJUP6mY Dc+A== 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:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=jpK6RUy32ei8i4SVsRPfVXER6PNVYBkFJpDkjmxLwTk=; fh=fa0YJSH7y4k0snNuxsKgOI6vGP7j2f0jR9F1WHC95UA=; b=oq+xDkg6tWOKladyYHlIk7LkCN8x/hc+hRlUHDEs4d9DfOhwZuoJEngvjt6g4oY2M9 fntFvLQQ88N2+sSredf3yXNRxgpbVaE/ESdv0FtptNPH/qpiuVEVhdzDDWIRDVNjtJiB 4VQxbyZXcsaU4LOYLmp0NAxmCliaG6fOsd6MQMItE6npyjfxKKZt+IwnNrkLa8uA5Kbf ZQbqtOfYlvV5MO3zegT66L4tBy5OjehR/nZ/5TVgs99ucBA9vbMqwFMndUuD+rM0lU4a VmRdId8rlgl4Nl/6ht075FT6orlhyR4zZTwN6BstUTH1+4ze9Z1pgzdNjLcyDfG69WfV 21Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=C4eGJ2TX; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id s25-20020aa7d799000000b0052227f13c0csi2090674edq.394.2023.08.04.13.23.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 13:23:00 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=C4eGJ2TX; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 2A4643858033 for ; Fri, 4 Aug 2023 20:22:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A4643858033 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691180579; bh=jpK6RUy32ei8i4SVsRPfVXER6PNVYBkFJpDkjmxLwTk=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=C4eGJ2TXCDubq8WB7NF9ibUT+y9ZtGz4ZLesJWd759ZVvnNQDBfPXqfNFO8HOcVAr LUm5djZe1KribeWJWBLDA3G20AIXNRnBjFYyoSvboBEsjgp9BmCS3aC+fUbrPuJk1B pVeLJtorWVOze7j+2evOqPcmon/PT9e1zml8Dvic= 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 C1EC43857C71 for ; Fri, 4 Aug 2023 20:22:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C1EC43857C71 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-346-HqHUc6UzNmOO21eTRZGnbg-1; Fri, 04 Aug 2023 16:22:15 -0400 X-MC-Unique: HqHUc6UzNmOO21eTRZGnbg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 29C0629AA386 for ; Fri, 4 Aug 2023 20:22:15 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.22.8.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id E98E22166B25; Fri, 4 Aug 2023 20:22:14 +0000 (UTC) To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [pushed] analyzer: fix some svalue::dump_to_pp implementations Date: Fri, 4 Aug 2023 16:22:13 -0400 Message-Id: <20230804202213.1447631-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 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, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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: INBOX X-GMAIL-THRID: 1773331368183531049 X-GMAIL-MSGID: 1773331368183531049 Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r14-3000-g187b213ddbe7ea. gcc/analyzer/ChangeLog: * svalue.cc (region_svalue::dump_to_pp): Support NULL type. (constant_svalue::dump_to_pp): Likewise. (initial_svalue::dump_to_pp): Likewise. (conjured_svalue::dump_to_pp): Likewise. Fix missing print of the type. --- gcc/analyzer/svalue.cc | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/gcc/analyzer/svalue.cc b/gcc/analyzer/svalue.cc index 4395018dbc3..5d5c80f88c6 100644 --- a/gcc/analyzer/svalue.cc +++ b/gcc/analyzer/svalue.cc @@ -714,8 +714,11 @@ region_svalue::dump_to_pp (pretty_printer *pp, bool simple) const else { pp_string (pp, "region_svalue("); - print_quoted_type (pp, get_type ()); - pp_string (pp, ", "); + if (get_type ()) + { + print_quoted_type (pp, get_type ()); + pp_string (pp, ", "); + } m_reg->dump_to_pp (pp, simple); pp_string (pp, ")"); } @@ -811,8 +814,11 @@ constant_svalue::dump_to_pp (pretty_printer *pp, bool simple) const else { pp_string (pp, "constant_svalue("); - print_quoted_type (pp, get_type ()); - pp_string (pp, ", "); + if (get_type ()) + { + print_quoted_type (pp, get_type ()); + pp_string (pp, ", "); + } dump_tree (pp, m_cst_expr); pp_string (pp, ")"); } @@ -1029,8 +1035,11 @@ initial_svalue::dump_to_pp (pretty_printer *pp, bool simple) const else { pp_string (pp, "initial_svalue("); - print_quoted_type (pp, get_type ()); - pp_string (pp, ", "); + if (get_type ()) + { + print_quoted_type (pp, get_type ()); + pp_string (pp, ", "); + } m_reg->dump_to_pp (pp, simple); pp_string (pp, ")"); } @@ -1910,7 +1919,11 @@ conjured_svalue::dump_to_pp (pretty_printer *pp, bool simple) const else { pp_string (pp, "conjured_svalue ("); - pp_string (pp, ", "); + if (get_type ()) + { + print_quoted_type (pp, get_type ()); + pp_string (pp, ", "); + } pp_gimple_stmt_1 (pp, m_stmt, 0, (dump_flags_t)0); pp_string (pp, ", "); m_id_reg->dump_to_pp (pp, simple);