public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "qinzhao at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106457] array_at_struct_end_p returns TRUE for a two-dimension array which is not inside any structure
Date: Thu, 04 Aug 2022 17:59:57 +0000	[thread overview]
Message-ID: <bug-106457-4-NLo9JGrlf4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106457-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106457

--- Comment #6 from qinzhao at gcc dot gnu.org ---
the following patch fixed the issue:

[opc@qinzhao-aarch64-ol8 gcc]$ git diff tree.cc
diff --git a/gcc/tree.cc b/gcc/tree.cc
index fed1434d141d..d04ac121765a 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -12779,7 +12779,7 @@ array_at_struct_end_p (tree 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))
+      if (TREE_CODE (TREE_TYPE (ref)) == ARRAY_TYPE)
        return false;

       /* Check whether the array domain covers all of the available

  parent reply	other threads:[~2022-08-04 17:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-27 18:43 [Bug tree-optimization/106457] New: " qinzhao at gcc dot gnu.org
2022-07-28  8:07 ` [Bug tree-optimization/106457] " rguenth at gcc dot gnu.org
2022-07-28 12:35 ` cvs-commit at gcc dot gnu.org
2022-07-28 12:36 ` rguenth at gcc dot gnu.org
2022-08-01 21:11 ` qinzhao at gcc dot gnu.org
2022-08-01 21:13 ` qinzhao at gcc dot gnu.org
2022-08-04 17:59 ` qinzhao at gcc dot gnu.org [this message]
2022-08-08 15:13 ` qinzhao at gcc dot gnu.org
2022-08-09 14:11 ` qinzhao at gcc dot gnu.org
2022-08-09 14:16 ` qinzhao at gcc dot gnu.org

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=bug-106457-4-NLo9JGrlf4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).