public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
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:37:16 +0200 (CEST)	[thread overview]
Message-ID: <nycvar.YFH.7.76.2009251335150.10073@p653.nepu.fhfr.qr> (raw)
In-Reply-To: <20200925112030.GU2176@tucnak>

On Fri, 25 Sep 2020, Jakub Jelinek wrote:

> 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).

See my comment above for Martins attempts to improve things.  I don't
really want to try decide what to do with those late diagnostic IL
printing but my commit was blamed for showing target-mem-ref unsupported.

I don't have much time to spend to think what to best print and what not,
but yes, printing only the MEM_REF part is certainly imprecise.

I'll leave the PR to FE folks.

Thanks,
Richard.

> > 
> > 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
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imend

  reply	other threads:[~2020-09-25 11:37 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
2020-09-25 11:37   ` Richard Biener [this message]
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=nycvar.YFH.7.76.2009251335150.10073@p653.nepu.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /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).