From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 06B7C3858D35; Mon, 22 May 2023 18:04:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 06B7C3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684778682; bh=HsG36esdyPZXAgIWwDmd7X5wg92UljjVQs9vjnXU7Vg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rnO39CHgz/ZAs2yqJri4LMgqjYXH740c4GNFrHkC1NjkgAvV4OAueY1hufF9PCOUP rVh5KH5Kl81JGg4pxoC63peRhYcI+itj6GNIjIHbtF5hn2fFvP0N7ayI6O4u94CY76 PQf5R4RGfJKCZQ7UqdSnYKx2pA9gkPVBxRZCRWSY= From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/109886] UBSAN error: shift exponent 64 is too large for 64-bit type when compiling gcc.c-torture/compile/pr96796.c Date: Mon, 22 May 2023 18:04:41 +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: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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=3D109886 --- Comment #2 from Aldy Hernandez --- (In reply to Andrew Pinski from comment #1) > Breakpoint 6, range_cast (r=3D..., type=3D= ) at > /home/apinski/src/upstream-gcc/gcc/gcc/range-op.cc:4853 > 4853 Value_Range tmp (r); >=20 >=20 > Confirmed. > The code looks like: > ``` > int g_5, func_1_l_32, func_50___trans_tmp_31; > ... > int func_1() { func_50(g_3_4, g_5, func_1_l_32, 8, 3); } > ... > struct S0 *func_50(int p_51, struct S0 p_52, struct S1 p_53, int p_54, > int p_55) { > ... > } > ``` >=20 > Code in gcc: > if (TREE_CODE (arg) =3D=3D SSA_NAME > && param_type > /* Limit the ranger query to integral types as the rest > of this file uses value_range's, which only hold > integers and pointers. */ > && irange::supports_p (TREE_TYPE (arg)) > && get_range_query (cfun)->range_of_expr (vr, arg) > && !vr.undefined_p ()) > { > value_range resvr =3D vr; > range_cast (resvr, param_type); > if (!resvr.undefined_p () && !resvr.varying_p ()) > ipa_set_jfunc_vr (jfunc, &resvr); > else > gcc_assert (!jfunc->m_vr); > } > else > gcc_assert (!jfunc->m_vr); >=20 >=20 > Maybe there should be an extra check for `irange::supports_p (param_type)` > too to catch the case where param_type type is not supported at all. If irange::supports_p (TREE_TYPE (arg)) is true, we're talking about an integer/pointer, but if range_cast is being called on a parm_type of RECORD_TYPE, someone's trying to cast a structure to an integer. Is that t= he intent here, because that will not work with ranges??=