From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B9AE83951C00; Thu, 13 Jan 2022 13:43:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9AE83951C00 From: "amacleod at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/78655] gcc doesn't exploit the fact that the result of pointer addition can not be nullptr Date: Thu, 13 Jan 2022 13:43:26 +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: 7.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: amacleod at redhat dot com 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 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: Thu, 13 Jan 2022 13:43:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D78655 --- Comment #13 from Andrew Macleod --- Probably. rangers nonnull processing also invokes infer_nonnull_range () on the statement, so should also be picking it up. The latter test case is really about recomputation then x_2 =3D a_1(D) =3D=3D 0B; a_3 =3D a_1(D) + 40; return x_2; When x_2 is defined, we don't know that it is non-null. we only know its non-null if we were to recompute its value at the use in return x_2. We can leave this for now.. I'll follow up with it when we revisit the nonn= ull processing and recomputation model for the next stage 1.=