From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id DE9D93857C4E for ; Fri, 25 Sep 2020 11:11:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DE9D93857C4E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rguenther@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 02045ADB3; Fri, 25 Sep 2020 11:11:38 +0000 (UTC) Date: Fri, 25 Sep 2020 13:11:37 +0200 (CEST) From: Richard Biener Sender: rguenther@ryzen.fritz.box To: gcc-patches@gcc.gnu.org cc: jakub@redhat.com Subject: [PATCH] c++/97197 - support TARGET_MEM_REF in C/C++ error pretty-printing Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, 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:11:40 -0000 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. 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. --- gcc/c-family/c-pretty-print.c | 3 +++ gcc/cp/error.c | 1 + 2 files changed, 4 insertions(+) diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index acffd7b872c..1a0edb82312 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/gcc/c-family/c-pretty-print.c @@ -1693,6 +1693,7 @@ c_pretty_printer::postfix_expression (tree e) break; case MEM_REF: + case TARGET_MEM_REF: expression (e); break; @@ -1833,6 +1834,7 @@ c_pretty_printer::unary_expression (tree e) break; case MEM_REF: + case TARGET_MEM_REF: if (TREE_CODE (TREE_OPERAND (e, 0)) == ADDR_EXPR && integer_zerop (TREE_OPERAND (e, 1))) expression (TREE_OPERAND (TREE_OPERAND (e, 0), 0)); @@ -2295,6 +2297,7 @@ c_pretty_printer::expression (tree e) case ADDR_EXPR: case INDIRECT_REF: case MEM_REF: + case TARGET_MEM_REF: case NEGATE_EXPR: case BIT_NOT_EXPR: case TRUTH_NOT_EXPR: diff --git a/gcc/cp/error.c b/gcc/cp/error.c index ecb41e82d8c..c9a0c1e0288 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -2372,6 +2372,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags) break; case MEM_REF: + case TARGET_MEM_REF: if (TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR && integer_zerop (TREE_OPERAND (t, 1))) dump_expr (pp, TREE_OPERAND (TREE_OPERAND (t, 0), 0), flags); -- 2.26.2