From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A44B13858D28; Mon, 15 Jan 2024 14:58:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A44B13858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705330738; bh=wl/xjRFaFL/cmWRNu+cG/IjqrKRMlPvtmmQaY3R0BLs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VaEd+Hk3EtR0CAhkbhwDhQA7W5uWLHuCgZqGiVzqXdMRQdQZnQM14OGvUDKo0m1kR ouNvP9MtQ5AdH0ovfK3ZOrMTKnJF70e58kT2YSbBdEV59ZTkB359LCiCSvlm3XPsbX KQA1RhZ2y7x7gMtkXG5blkB+1NbDLdKO6iE2NyPE= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113372] wrong code with _BitInt() arithmetics at -O1 Date: Mon, 15 Jan 2024 14:58:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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=3D113372 --- Comment #17 from Jakub Jelinek --- (In reply to Richard Biener from comment #15) > (In reply to Jakub Jelinek from comment #14) > > Created attachment 57085 [details] > > gcc14-pr113372.patch > >=20 > > The non-propagation workaround which seems to fix^H^H^Hworkaround all t= hose > > 4 issues (PR90348 testcase actually doesn't FAIL anymore, but I've veri= fied > > the patch results in in and buf no longer being shared) can look like t= his. >=20 > + || (INTEGRAL_TYPE_P (TREE_TYPE (use)) > + && TYPE_PRECISION (TREE_TYPE (use)) =3D=3D POINTER_SIZE))) >=20 > ptrofftype_p (TREE_TYPE (use)) Aren't there targets where pointers are larger than sizetype? I thought msp430, but that one uses __int20. > I think it should be enough to look at gimple_assing_rhs1, that works > for single non-invariant &a[i], for conversions and for offsetting of > an invariant address (pointer-plus). Is the invariant operand guaranteed to go first? If it is pointer, guess POINTER_PLUS_EXPR enforces that, and for sizetype addition guess an operand can't be ADDR_EXPR, there would need to be a cast in a separate stmt. So perhaps ok. As for Micha's fears, I can certainly try to dump statistics during bootstrap/regtest on how many variables were shared and/or their cumulative size without/with the patch and see if it has significant effects on real-w= orld code.=