public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/gccgo] sra: Only verify sizes of scalar accesses (PR 93845)
Date: Sat,  4 Apr 2020 21:20:14 +0000 (GMT)	[thread overview]
Message-ID: <20200404212014.4BA2A3950C1E@sourceware.org> (raw)

https://gcc.gnu.org/g:4d6bf96b583d77336cf6ca643d92d068a88414fa

commit 4d6bf96b583d77336cf6ca643d92d068a88414fa
Author: Martin Jambor <mjambor@suse.cz>
Date:   Fri Feb 21 13:38:22 2020 +0100

    sra: Only verify sizes of scalar accesses (PR 93845)
    
    the testcase is another example - in addition to recent PR 93516 - where
    the SRA access verifier is confused by the fact that get_ref_base_extent
    can return different sizes for the same type, depending whether they are
    COMPONENT_REF or not.  In the previous bug I decided to keep the
    verifier check for aggregate type even though it is not really important
    and instead avoid easily detectable type-within-the-same-type situation.
    This testcase is however a result of a fairly random looking type cast
    and so cannot be handled in the same way.
    
    Because the check is not really important for aggregates, this patch
    simply disables it for non-register types.
    
    2020-02-21  Martin Jambor  <mjambor@suse.cz>
    
            PR tree-optimization/93845
            * tree-sra.c (verify_sra_access_forest): Only test access size of
            scalar types.
    
            testsuite/
            * g++.dg/tree-ssa/pr93845.C: New test.

Diff:
---
 gcc/ChangeLog                           |  6 ++++++
 gcc/testsuite/ChangeLog                 |  5 +++++
 gcc/testsuite/g++.dg/tree-ssa/pr93845.C | 30 ++++++++++++++++++++++++++++++
 gcc/tree-sra.c                          |  3 ++-
 4 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1845563d0bb..d0c9f2970e2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-02-21  Martin Jambor  <mjambor@suse.cz>
+
+	PR tree-optimization/93845
+	* tree-sra.c (verify_sra_access_forest): Only test access size of
+	scalar types.
+
 2020-02-21  Andrew Stubbs  <ams@codesourcery.com>
 
 	* config/gcn/gcn.c (gcn_hard_regno_mode_ok): Align VGPR pairs.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8518061aa28..ad4f43529da 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-02-21  Martin Jambor  <mjambor@suse.cz>
+
+	PR tree-optimization/93845
+	* g++.dg/tree-ssa/pr93845.C: New test.
+
 2020-02-21  Richard Sandiford  <richard.sandiford@arm.com>
 
 	* gcc.target/aarch64/sve/rsqrt_1.c: New test.
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr93845.C b/gcc/testsuite/g++.dg/tree-ssa/pr93845.C
new file mode 100644
index 00000000000..72e473fffcd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr93845.C
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+struct g;
+struct h {
+  g *operator->();
+};
+class i {
+  void *a;
+  int b;
+
+public:
+  template <typename f> f j() { return *static_cast<f *>(this); }
+};
+struct k : i {};
+struct l : k {};
+struct m {
+  i n();
+  i o(l, l, int);
+};
+struct g {
+  void m_fn4(k);
+};
+h a;
+i b;
+i m::n() {
+  l c, d, e = o(d, c, 0).j<l>();
+  a->m_fn4(e);
+  return b;
+}
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 49f9001f7fb..5561ea6f655 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2355,7 +2355,8 @@ verify_sra_access_forest (struct access *root)
       gcc_assert (offset == access->offset);
       gcc_assert (access->grp_unscalarizable_region
 		  || size == max_size);
-      gcc_assert (max_size == access->size);
+      gcc_assert (!is_gimple_reg_type (access->type)
+		  || max_size == access->size);
       gcc_assert (reverse == access->reverse);
 
       if (access->first_child)


                 reply	other threads:[~2020-04-04 21:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200404212014.4BA2A3950C1E@sourceware.org \
    --to=ian@gcc.gnu.org \
    --cc=gcc-cvs@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).