From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B1A223858D3C; Wed, 29 Mar 2023 22:20:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B1A223858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680128446; bh=sUBs1FYTjIFIbj9XkAUza1Ay1WepLLIUXgAA7Xr0P+8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sHWQWfA3Z6jjUKghKJFW9asxN4vSR6JwxAtu/Zi7fMNFr9mRBkXyNEoFipJEoNLpf WRynHWvt26aDNm9kCEE1r93SyzlMOfUXV2V8tm9UzAVA2yD9VYKAOy3PqqSZHBwOE9 R6yaCQNApUBKrYm7j9HdMOnxOaovUgNMA2+6ElZ8= From: "jamborm at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jamborm at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109303 --- Comment #5 from Martin Jambor --- (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; >=20=20 > - if (item->offset < 0 || item->jftype =3D=3D IPA_JF_UNKNOWN) > + if (item->offset < 0 > + || item->jftype =3D=3D IPA_JF_UNKNOWN > + || item->offset >=3D (HOST_WIDE_INT) UINT_MAX * BITS_PER_UNIT) > continue; > val_size =3D tree_to_shwi (TYPE_SIZE (item->type)); >=20=20 > 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 =3D list->offset - arg_offset; gcc_assert ((item.offset % BITS_PER_UNIT) =3D=3D 0); + if (item.offset + list->size >=3D (HOST_WIDE_INT) UINT_MAX * BITS_PER_UNIT) + continue; jfunc->agg.items->quick_push (item); }=