From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0339D385702F; Thu, 11 May 2023 12:47:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0339D385702F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683809278; bh=9s3KnpXhHolpKAzszn1qemTonQGa/SVph+5zck3k8rA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KygoDsBpIdv4nmqvTNgWJVOdtS2QGAgzA0sI92rjoDzvCbb+WLpXEjKFZkz4c/y9D LCdeEqOjF0ijVA7JcB/uLULJQ1klCYkoOxieefqRkuLClyvrEiOXtztMDsm667GDko Lkvt9Jvj7w0AELsqzE8708Q62X0o89IHqj+pnup4= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/109393] Very trivial address calculation does not fold Date: Thu, 11 May 2023 12:47:57 +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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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=3D109393 --- Comment #5 from Richard Biener --- (In reply to manolis.tsamis from comment #4) > Given the original transform it should be valid to propagate the constant > addition through the cast? Yes. Note doing so loses information, we know i + 1 doesn't overflow (undefined behavior). Widening preserves this knowledge I think, but if just an unsigned conversion would be propagated it would be lost.=