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 08:09:22 +0000	[thread overview]
Message-ID: <bug-99824-4-6ek50q0kot@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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so I guess that things go wrong in wi::min_value where we nowhere check
that the precision we're asking for (384) fits in a wide_int,
WIDE_INT_MAX_PRECISION should be 160 (MAX_BITSIZE_MODE_ANY_INT) rounded up
to 64bits thus 192.  That then clobbers the stack somewhere and things go
wrong.

This is likely uncovered by the PR98834 "fix"
g592388d4f6e8a6adb470428fef6195694f4a3dce (but this fix shouldn't expose
such large precisions by itself)

I still like to reproduce it to see what events lead to such large requested
precision.  On trunk sth like

diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 784f131ebb8..94b8b21c7a8 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -2838,6 +2838,8 @@ set_min_and_max_values_for_integral_type (tree type,
   if (precision < 1)
     return;

+  gcc_assert (precision <= WIDE_INT_MAX_PRECISION);
+
   TYPE_MIN_VALUE (type)
     = wide_int_to_tree (type, wi::min_value (precision, sgn));
   TYPE_MAX_VALUE (type)

should uncover any similar issue and eventually allow producing smaller
testcases.

  parent reply	other threads:[~2021-03-30  8:09 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 [this message]
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
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-6ek50q0kot@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).