From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DECEC3858D37; Tue, 19 Mar 2024 14:18:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DECEC3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710857931; bh=QSSCv2fXBULT7QSl2xS8WPvBcRkpmcFkQilRpq1QKgQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rLMXYv3HNZmFQ+SAcBKDurPwQ2V/YtdB7Pnsy4guXh1bQDq+IgApypdHq0S+l/+O9 x3f/OjN4HgHT23BVwUFGKNTnCHORfkLLdHv6WIShIpaxF7zlKM6XZfNpvAFvYV26bY nvg4iCfrx3FzjfvCTUMXH5B3yR3PGrtRulGA8C/A= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50 Date: Tue, 19 Mar 2024 14:18:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to 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=3D113396 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org --- Comment #30 from Richard Biener --- It's LIM2 which applies store-motion to m[0] but keeps m[p] in the loop. Then with range-info for the int128 of [0, +INF] we get into get_ref_base_and_extent: query =3D get_range_query (cfun); if (TREE_CODE (index) =3D=3D SSA_NAME && (low_bound =3D array_ref_low_bound (exp), poly_int_tree_p (low_bound)) && (unit_size =3D array_ref_element_size (exp), TREE_CODE (unit_size) =3D=3D INTEGER_CST) && query->range_of_expr (vr, index) && !vr.varying_p () && !vr.undefined_p ()) { wide_int min =3D vr.lower_bound (); wide_int max =3D vr.upper_bound (); poly_offset_int lbound =3D wi::to_poly_offset (low_boun= d); /* Try to constrain maxsize with range information. */ offset_int omax =3D offset_int::from (max, TYPE_SIGN (TREE_TYPE (inde= x))); if (known_lt (lbound, omax)) { poly_offset_int rmaxsize; rmaxsize =3D (omax - lbound + 1) * wi::to_offset (unit_size) << LOG2_BITS_PER_UN= IT; if (!known_size_p (maxsize) || known_lt (rmaxsize, maxsize)) and compute rmaxsize =3D=3D 0. What's definitely questionable here is the offset_int::from, though it fits. But omax - lbound + 1 overflows to zero here. It's probably better to use widest-int here, even if that's possibly slower than offset_int. Or ensure offset_int has one more bit than required for the index type (offset_int has 64bit + 3bits, so 128bits).=