public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/99824] [10 Regression] ICE in wide_int_to_tree_1, at tree.c:1572
Date: Tue, 30 Mar 2021 09:22:03 +0000	[thread overview]
Message-ID: <bug-99824-4-vngiPafxPF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99824-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Changing ao_ref_init_from_vn_reference to avoid excess sizes (in excess of the
access type specified) like with

diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 4b280f21006..926b4a976ae 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -996,22 +996,26 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
   poly_offset_int size = -1;
   tree size_tree = NULL_TREE;

-  /* First get the final access size from just the outermost expression.  */
+  machine_mode mode = TYPE_MODE (type);
+  if (mode == BLKmode)
+    size_tree = TYPE_SIZE (type);
+  else
+    size = GET_MODE_BITSIZE (mode);
+  if (size_tree != NULL_TREE
+      && poly_int_tree_p (size_tree))
+    size = wi::to_poly_offset (size_tree);
+
+  /* Lower the final access size from the outermost expression.  */
   op = &ops[0];
+  size_tree = NULL_TREE;
   if (op->opcode == COMPONENT_REF)
     size_tree = DECL_SIZE (op->op0);
   else if (op->opcode == BIT_FIELD_REF)
     size_tree = op->op0;
-  else
-    {
-      machine_mode mode = TYPE_MODE (type);
-      if (mode == BLKmode)
-       size_tree = TYPE_SIZE (type);
-      else
-       size = GET_MODE_BITSIZE (mode);
-    }
   if (size_tree != NULL_TREE
-      && poly_int_tree_p (size_tree))
+      && poly_int_tree_p (size_tree)
+      && (!known_size_p (size)
+         || known_lt (wi::to_poly_offset (size_tree), size)))
     size = wi::to_poly_offset (size_tree);

   /* Initially, maxsize is the same as the accessed element size.

avoids hitting the assert.

  parent reply	other threads:[~2021-03-30  9:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30  7:07 [Bug tree-optimization/99824] New: " marxin at gcc dot gnu.org
2021-03-30  7:08 ` [Bug tree-optimization/99824] [10 Regression] " marxin at gcc dot gnu.org
2021-03-30  7:19 ` marxin at gcc dot gnu.org
2021-03-30  7:42 ` rguenth at gcc dot gnu.org
2021-03-30  7:42 ` rguenth at gcc dot gnu.org
2021-03-30  8:09 ` rguenth at gcc dot gnu.org
2021-03-30  8:24 ` marxin at gcc dot gnu.org
2021-03-30  8:30 ` marxin at gcc dot gnu.org
2021-03-30  9:14 ` rguenth at gcc dot gnu.org
2021-03-30  9:16 ` rguenth at gcc dot gnu.org
2021-03-30  9:22 ` rguenth at gcc dot gnu.org [this message]
2021-03-30  9:30 ` rguenth at gcc dot gnu.org
2021-03-30  9:32 ` marxin at gcc dot gnu.org
2021-03-30 10:03 ` rguenther at suse dot de
2021-03-30 10:08 ` marxin at gcc dot gnu.org
2021-03-30 10:13 ` marxin at gcc dot gnu.org
2021-03-30 12:01 ` cvs-commit at gcc dot gnu.org
2021-03-30 12:02 ` cvs-commit at gcc dot gnu.org
2021-03-30 12:02 ` rguenth 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-99824-4-vngiPafxPF@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).