public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jamborm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/109303] [13 Regression] ICE in push_agg_values_from_plats, at ipa-cp.cc:1458 since r13-3358-ge0403e95689af7d5
Date: Wed, 29 Mar 2023 22:20:46 +0000	[thread overview]
Message-ID: <bug-109303-4-zGQw8l1TJp@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109303-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #4)
> --- gcc/ipa-cp.cc.jj	2023-03-14 19:12:19.949553036 +0100
> +++ gcc/ipa-cp.cc	2023-03-29 18:32:34.148888423 +0200
> @@ -3117,7 +3117,9 @@ propagate_aggs_across_jump_function (str
>  	{
>  	  HOST_WIDE_INT val_size;
>  
> -	  if (item->offset < 0 || item->jftype == IPA_JF_UNKNOWN)
> +	  if (item->offset < 0
> +	      || item->jftype == IPA_JF_UNKNOWN
> +	      || item->offset >= (HOST_WIDE_INT) UINT_MAX * BITS_PER_UNIT)
>  	    continue;
>  	  val_size = tree_to_shwi (TYPE_SIZE (item->type));
>  
> fixes the ICE and is then similar to the PR108605 fix.  Dunno if the code
> can overflow also offset + size computations or something protects against
> that.
> Anyway, I think it would be worth it to switch all those unsigned int byte
> offsets to
> unsigned HOST_WIDE_INTs for GCC 14.

Actually, I am in the process of doing the reverse in order to try and
keep the memory footprint of the structures small.  (The reason why
the HOST_WIDE_BITs are signed is what get_ref_base_and_extent used to
return).  Unfortunately what I wanted to do but forgot is the
following (only lightly tested so far, it has the benefit that
uselessly large offsets are not even streamed):

diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
index de45dbccf16..edc1f469914 100644
--- a/gcc/ipa-prop.cc
+++ b/gcc/ipa-prop.cc
@@ -1735,6 +1735,8 @@ build_agg_jump_func_from_list (struct
ipa_known_agg_contents_list *list,

       item.offset = list->offset - arg_offset;
       gcc_assert ((item.offset % BITS_PER_UNIT) == 0);
+      if (item.offset + list->size >= (HOST_WIDE_INT) UINT_MAX *
BITS_PER_UNIT)
+       continue;

       jfunc->agg.items->quick_push (item);
     }

  parent reply	other threads:[~2023-03-29 22:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 18:41 [Bug c/109303] New: [13 Regression] ICE in push_agg_values_from_plats, at ipa-cp.cc:1458 gscfq@t-online.de
2023-03-27 18:52 ` [Bug ipa/109303] " pinskia at gcc dot gnu.org
2023-03-27 20:06 ` [Bug ipa/109303] [13 Regression] ICE in push_agg_values_from_plats, at ipa-cp.cc:1458 since r13-3358-ge0403e95689af7d5 marxin at gcc dot gnu.org
2023-03-28  7:22 ` rguenth at gcc dot gnu.org
2023-03-29 15:37 ` jakub at gcc dot gnu.org
2023-03-29 16:26 ` jakub at gcc dot gnu.org
2023-03-29 16:40 ` jakub at gcc dot gnu.org
2023-03-29 22:20 ` jamborm at gcc dot gnu.org [this message]
2023-03-30  7:21 ` jakub at gcc dot gnu.org
2023-03-30  7:28 ` jakub at gcc dot gnu.org
2023-03-30 16:48 ` jamborm at gcc dot gnu.org
2023-03-31  8:51 ` jamborm at gcc dot gnu.org
2023-04-03 14:01 ` cvs-commit at gcc dot gnu.org
2023-04-03 14:02 ` jamborm at gcc dot gnu.org
2023-04-05  8:40 ` marxin at gcc dot gnu.org
2023-04-05  8:40 ` marxin 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-109303-4-zGQw8l1TJp@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).