From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 625F83987973 for ; Fri, 25 Sep 2020 11:20:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 625F83987973 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-6-qqS34xoFNl-VAU8ByWd7GA-1; Fri, 25 Sep 2020 07:20:36 -0400 X-MC-Unique: qqS34xoFNl-VAU8ByWd7GA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A2868C3CE2; Fri, 25 Sep 2020 11:20:35 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-37.ams2.redhat.com [10.36.112.37]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E106360C04; Fri, 25 Sep 2020 11:20:34 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 08PBKV8B024348; Fri, 25 Sep 2020 13:20:31 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 08PBKUn5024252; Fri, 25 Sep 2020 13:20:30 +0200 Date: Fri, 25 Sep 2020 13:20:30 +0200 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] c++/97197 - support TARGET_MEM_REF in C/C++ error pretty-printing Message-ID: <20200925112030.GU2176@tucnak> Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Fri, 25 Sep 2020 11:20:58 -0000 On Fri, Sep 25, 2020 at 01:11:37PM +0200, Richard Biener wrote: > This adds rough support to avoid "'target_mem_ref' not supported by" > in diagnostics. There were recent patches by Martin to sanitize > dumping of MEM_REF so I'm not trying to interfere with this here. Is that correct? I mean, TARGET_MEM_REF encodes more than what MEM_REF encodes, so printing it like MEM_REF will ignore many things from there. I'd say we should print it like: *(type *)(BASE + STEP * INDEX + INDEX2 + OFFSET) rather than how we print MEM_REFs as *(type *)(BASE + OFFSET) (with skipping whatever is NULL in there). So instead of adding case MEM_REF: in the second and last hunk copy and edit it (perhaps kill the probably unnecessary part that checks for *&foo and prints it as foo, because who would create TARGET_MEM_REF when MEM_REF could have been used in that case). > > Bootstrap & regtest pending. > > OK? > > 2020-09-25 Richard Biener > > PR c++/97197 > cp/ > * error.c (dump_expr): Handle TARGET_MEM_REF as if it > were MEM_REF. > > c-family/ > * c-pretty-print.c (c_pretty_printer::postfix_expression): > Handle TARGET_MEM_REF as expression. > (c_pretty_printer::expression): Handle TARGET_MEM_REF as > unary_expression. > (c_pretty_printer::unary_expression): Handle TARGET_MEM_REF > as if it were MEM_REF. Jakub