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  <rguent...@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 via email to