public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Martin Sebor <msebor@gmail.com>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] correct the representation of ADDR_EXPR involving pointer to array [PR 90694]
Date: Fri, 31 May 2019 21:22:00 -0000	[thread overview]
Message-ID: <40f90d08-e1a2-c220-952f-35a8d3a11bf7@redhat.com> (raw)
In-Reply-To: <46673e65-eefd-68d5-088b-1a9723a84a9c@gmail.com>

On 5/31/19 1:56 PM, Martin Sebor wrote:
> Given a poiner to array p, tree dumps for expressions like &(*p)[2]
> actually show &*p[2].  That's not right -- the parentheses are
> important to differentiate indexing into the array the pointer
> points to from indexing into the pointer.
> 
> The attached patch adjusts the tree pretty printer to add the parens
> when the pointer points to an array.
> 
> Tested on x86_64-linux.
> 
> Martin
> 
> gcc-90694.diff
> 
> PR middle-end/90694 - incorrect representation of ADDR_EXPR involving a pointer to array
> 
> gcc/ChangeLog:
> 
> 	PR middle-end/90694
> 	* tree-pretty-print.c (dump_generic_node): Add parentheses.
> 
> gcc/testsuite/ChangeLog:
> 
> 	PR middle-end/90694
> 	* gcc.dg/tree-ssa/dump-5.c: New test.
OK.  I'm going to assume that the gimple parser already does the right
thing since it's supposed to already handle C expressions correctly.

Jeff

  reply	other threads:[~2019-05-31 20:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31 20:34 Martin Sebor
2019-05-31 21:22 ` Jeff Law [this message]
2019-06-03  9:42   ` Richard Biener

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=40f90d08-e1a2-c220-952f-35a8d3a11bf7@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=msebor@gmail.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).