From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 897F4386188D; Mon, 21 Dec 2020 09:28:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 897F4386188D From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/98404] ldist might punt on too large expressions for detected patterns with -Os Date: Mon, 21 Dec 2020 09:28:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: REOPENED 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: short_desc everconfirmed cc cf_reconfirmed_on bug_status resolution 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2020 09:28:41 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98404 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Compiler emits unexpected |ldist might punt on too |function call that may |large expressions for |cause security problems |detected patterns with -Os Ever confirmed|0 |1 CC| |rguenth at gcc dot gnu.org Last reconfirmed| |2020-12-21 Status|RESOLVED |REOPENED Resolution|INVALID |--- --- Comment #3 from Jakub Jelinek --- Well, for -Os I guess we should reopen this for the case where the expressi= ons needed for the detected patterns look too big. ldist in this case turns the loop into: _34 =3D _3 + -1; _33 =3D (unsigned int) _34; _32 =3D (sizetype) _33; _35 =3D _32 * 8; _36 =3D _3 > 0 ? _35 : 0; _37 =3D (long unsigned int) nm_25; _38 =3D _37 * 8; _39 =3D (sizetype) _33; _40 =3D 1 - _39; _41 =3D _40 * 8; _42 =3D _3 > 0 ? _41 : 8; _43 =3D _38 + _42; _44 =3D p_20 + _43; _45 =3D (long unsigned int) nm_25; _46 =3D _45 * 8; _47 =3D (unsigned int) _34; _48 =3D (sizetype) _47; _49 =3D 1 - _48; _50 =3D _49 * 8; _51 =3D _3 > 0 ? _50 : 8; _52 =3D _46 + _51; _53 =3D _52 + 18446744073709551608; _54 =3D p_20 + _53; __builtin_memmove (_44, _54, _36); and while some of it is optimized later, we still have: _4 =3D (long unsigned int) nm_25; _5 =3D _4 * 8; _6 =3D p_20 + _5; _33 =3D (unsigned int) nm_25; _32 =3D (sizetype) _33; _35 =3D _32 * 8; _36 =3D _3 > 0 ? _35 : 0; _40 =3D 1 - _32; _41 =3D _40 * 8; _42 =3D _3 > 0 ? _41 : 8; _43 =3D _5 + _42; _44 =3D p_20 + _43; _9 =3D _5 + 18446744073709551608; _53 =3D _9 + _42; _54 =3D p_20 + _53; in *.optimized.=