public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c++/97197 - support TARGET_MEM_REF in C/C++ error pretty-printing
Date: Fri, 25 Sep 2020 13:20:30 +0200	[thread overview]
Message-ID: <20200925112030.GU2176@tucnak> (raw)
In-Reply-To: <nycvar.YFH.7.76.2009251311080.5031@elmra.sevgm.obk>

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  <rguenther@suse.de>
> 
> 	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


  reply	other threads:[~2020-09-25 11:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25 11:11 Richard Biener
2020-09-25 11:20 ` Jakub Jelinek [this message]
2020-09-25 11:37   ` Richard Biener
2020-09-25 13:38     ` [PATCH v2] " Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200925112030.GU2176@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).