public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] middle-end/106457 - improve array_at_struct_end_p for array objects
Date: Thu, 28 Jul 2022 12:35:23 +0000 (UTC)	[thread overview]
Message-ID: <20220728123523.EjlnXYaNYLJ3szsumDXDT9s1mTGNoc31TXPC_qfuyCk@z> (raw)

Array references to array objects are never at struct end.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

	PR middle-end/106457
	* tree.cc (array_at_struct_end_p): Handle array objects
	specially.
---
 gcc/tree.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/tree.cc b/gcc/tree.cc
index 84000dd8b69..fed1434d141 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -12778,6 +12778,10 @@ array_at_struct_end_p (tree ref)
       && DECL_SIZE_UNIT (ref)
       && TREE_CODE (DECL_SIZE_UNIT (ref)) == INTEGER_CST)
     {
+      /* If the object itself is the array it is not at struct end.  */
+      if (DECL_P (ref_to_array))
+	return false;
+
       /* Check whether the array domain covers all of the available
          padding.  */
       poly_int64 offset;
-- 
2.35.3

             reply	other threads:[~2022-07-28 12:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 12:35 Richard Biener [this message]
2022-07-28 12:35 Richard Biener
2022-07-28 12:35 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=20220728123523.EjlnXYaNYLJ3szsumDXDT9s1mTGNoc31TXPC_qfuyCk@z \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    /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).