Message ID | 20230801003505.994240-1-ppalka@redhat.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2353469vqg; Mon, 31 Jul 2023 17:36:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlH9ClO8UpMR0Jxc8lWVeZbE2oYyDjGLpeHu5tm+EQJ/qFau42lCzRIXClFcInN98Gj0FPa3 X-Received: by 2002:a17:906:6498:b0:99b:ebf9:90d8 with SMTP id e24-20020a170906649800b0099bebf990d8mr1021156ejm.24.1690850203197; Mon, 31 Jul 2023 17:36:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690850203; cv=none; d=google.com; s=arc-20160816; b=ii25CR/Dc1uIaYTpQ+++Ii6sNU6RP8yjc3XDyaJoxjgNF1k5sEJRiefwf6xwmgqcng 92qkGFKX0yRdhGcdLMB0uoQZynZxdM+dxiRvbEYqeZR5SI0eTHUpkPAedwyxNL3lfosB O62wAQqDLjVM85B4nxsaiKdmnb+MfgwgkxeFi/PUiVG4CADYWWPRgA4/goys9CrU1tlU 5D144d+Vi2RnskXn/vz+4WrXiC56BLYUsXf7RpTCzZJgY8GVyHHOHxcmNkzRJIfv70iw JkAWriLLVqmnAavw7xDuX9uPZLPeRZYbZn1v1eBxS6wvekkQYkX7R3fKXe4xDewGlMpN RGOw== 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=ssLaMVzcmMPCz4dONoXl1f324f4A39BRC2ucfvUi3Is=; fh=M5GO8duY/t9+1sJXvBSRQ4u8k9z8sLFDsSO1kARbltQ=; b=NzNC+XGsRNfNYuMVXX8ZDkBhUUOamwWWUgDAPcrgOMmEA/zXKArV+YmuQPq2mUMMFO MtQ9Ux7TsjSKs7hYbcHz+6v7upWpzDNAiA6vSbJ/rXOsIyfL4VQJySI6s9rsFuZD1mnk znyf+m3ptpy+bTFLbnRV8w/rUTwmwnmNmraw7mcK3UNeAl8iP4z5gxvZpJBCp+f6cLc3 vTKBNPtM4YDUAI8aa/3rOmuWBa1pY7bN52/g4tKAsYxtXwB31XdUL//md94lj34BnmbJ fk+SQcc6C+DCm4dqKZUoeFr2M6lIpOJNWGaN5JQ6Z1SxYjgqGpBAfjesdc5fPc0tHlsA N3Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=C3xXgRme; 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id dv22-20020a170906b81600b00992a9b22b7fsi7029191ejb.668.2023.07.31.17.36.42 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 17:36:43 -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=C3xXgRme; 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 C64A23857704 for <ouuuleilei@gmail.com>; Tue, 1 Aug 2023 00:36:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C64A23857704 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690850175; bh=ssLaMVzcmMPCz4dONoXl1f324f4A39BRC2ucfvUi3Is=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=C3xXgRmeE+trbyKeC9qTgNDfoCaV8o7LdAabzOa5Y04owAj5LxehsxakX2PwHxJVc TWM/LMe2k22WUPL3q4MEDnmR8PqIIRO8Yo/ceCjaUv3if3RRKKjNwLf7TW0xZQ1p2l VVb//6fuRKrdlBSpqjo+/L9kuxLG8K3LPN9B/R4o= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id E8C79385841C for <gcc-patches@gcc.gnu.org>; Tue, 1 Aug 2023 00:35:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E8C79385841C Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-461-Swz5XJ2aOk2U22FlG8n5Ag-1; Mon, 31 Jul 2023 20:35:08 -0400 X-MC-Unique: Swz5XJ2aOk2U22FlG8n5Ag-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-63d41d1542dso57501936d6.0 for <gcc-patches@gcc.gnu.org>; Mon, 31 Jul 2023 17:35:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690850108; x=1691454908; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ssLaMVzcmMPCz4dONoXl1f324f4A39BRC2ucfvUi3Is=; b=CaC+fsi7QqOC+qPjAiP/8pywcyiWJGIDIuhmqHPNI3LhEYwYUsBa9ZbpX6czFS+DAL z498HVdltci6cARolW7383l/LBl8OIPvtcy9iycyh3jeCOZqqz0fBPsrAzr99F/qR2fp DODMODQXh1CknHXdGd9+NId8yN5cj+jEzR3cOoqLZp3ceXYvNHUWUYO2fHkqNjP3Z83s Vk86A3T1tBn3lw7HF5k+IuXbZwXEGJe3BXfX5FrybrAjUViFVbFAiM3JmXZBv7z6jZQI RqaipVsg7IHoN3ieTPiWppDxgfHmp1bJNk+Hx79BklltTWV1D0/CAndHjRc4bG06ax9E wW3w== X-Gm-Message-State: ABy/qLachMYfVyq/6d05rpeDwetwJc+bLTFByIhNCW3M/H5tXA55jO5h Pmm1mORV7noSg6o/yu2EpCStbDS+QTkRUNgCHV0Y3W3v3E7lver4cJhPpUMstAaIFn2knY7+I8q +4POEsiplR/qftyqsxVggw9/OJgCmNl+Q3c7MjZ6UKbSwMoxtogiatWXYU+2OD7/qzgDhrjSYm2 k= X-Received: by 2002:a0c:f3c8:0:b0:635:ec47:bfa0 with SMTP id f8-20020a0cf3c8000000b00635ec47bfa0mr11657596qvm.49.1690850108001; Mon, 31 Jul 2023 17:35:08 -0700 (PDT) X-Received: by 2002:a0c:f3c8:0:b0:635:ec47:bfa0 with SMTP id f8-20020a0cf3c8000000b00635ec47bfa0mr11657581qvm.49.1690850107505; Mon, 31 Jul 2023 17:35:07 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id i7-20020a0cab47000000b0063c71b62239sm4262800qvb.42.2023.07.31.17.35.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 17:35:07 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, Patrick Palka <ppalka@redhat.com> Subject: [PATCH] tree-pretty-print: handle COMPONENT_REF with non-decl RHS Date: Mon, 31 Jul 2023 20:35:05 -0400 Message-ID: <20230801003505.994240-1-ppalka@redhat.com> X-Mailer: git-send-email 2.41.0.478.gee48e70a82 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-13.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, T_SCC_BODY_TEXT_LINE 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Patrick Palka via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Patrick Palka <ppalka@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772984942689084596 X-GMAIL-MSGID: 1772984942689084596 |
Series |
tree-pretty-print: handle COMPONENT_REF with non-decl RHS
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Patrick Palka
Aug. 1, 2023, 12:35 a.m. UTC
Tested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- In the C++ front end, a COMPONENT_REF's second operand isn't always a decl (at least at template parse time). This patch makes the generic pretty printer not ICE when printing such a COMPONENT_REF. gcc/ChangeLog: * tree-pretty-print.cc (dump_generic_node) <case COMPONENT_REF>: Don't call component_ref_field_offset if the RHS isn't a decl. --- gcc/tree-pretty-print.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
Comments
On Tue, Aug 1, 2023 at 2:36 AM Patrick Palka via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Tested on x86_64-pc-linux-gnu, does this look OK for trunk? > > -- >8 -- > > In the C++ front end, a COMPONENT_REF's second operand isn't always a > decl (at least at template parse time). This patch makes the generic > pretty printer not ICE when printing such a COMPONENT_REF. > > gcc/ChangeLog: > > * tree-pretty-print.cc (dump_generic_node) <case COMPONENT_REF>: > Don't call component_ref_field_offset if the RHS isn't a decl. > --- > gcc/tree-pretty-print.cc | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/gcc/tree-pretty-print.cc b/gcc/tree-pretty-print.cc > index 25d191b10fd..da8dd002a3b 100644 > --- a/gcc/tree-pretty-print.cc > +++ b/gcc/tree-pretty-print.cc > @@ -2482,14 +2482,16 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags, > if (op_prio (op0) < op_prio (node)) > pp_right_paren (pp); > pp_string (pp, str); > - dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false); > - op0 = component_ref_field_offset (node); > - if (op0 && TREE_CODE (op0) != INTEGER_CST) > - { > - pp_string (pp, "{off: "); > - dump_generic_node (pp, op0, spc, flags, false); > + op1 = TREE_OPERAND (node, 1); > + dump_generic_node (pp, op1, spc, flags, false); > + if (DECL_P (op1)) OK if you add a comment before this test. > + if (tree off = component_ref_field_offset (node)) > + if (TREE_CODE (off) != INTEGER_CST) > + { > + pp_string (pp, "{off: "); > + dump_generic_node (pp, off, spc, flags, false); > pp_right_brace (pp); > - } > + } > break; > > case BIT_FIELD_REF: > -- > 2.41.0.478.gee48e70a82 >
diff --git a/gcc/tree-pretty-print.cc b/gcc/tree-pretty-print.cc index 25d191b10fd..da8dd002a3b 100644 --- a/gcc/tree-pretty-print.cc +++ b/gcc/tree-pretty-print.cc @@ -2482,14 +2482,16 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags, if (op_prio (op0) < op_prio (node)) pp_right_paren (pp); pp_string (pp, str); - dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false); - op0 = component_ref_field_offset (node); - if (op0 && TREE_CODE (op0) != INTEGER_CST) - { - pp_string (pp, "{off: "); - dump_generic_node (pp, op0, spc, flags, false); + op1 = TREE_OPERAND (node, 1); + dump_generic_node (pp, op1, spc, flags, false); + if (DECL_P (op1)) + if (tree off = component_ref_field_offset (node)) + if (TREE_CODE (off) != INTEGER_CST) + { + pp_string (pp, "{off: "); + dump_generic_node (pp, off, spc, flags, false); pp_right_brace (pp); - } + } break; case BIT_FIELD_REF: