From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BCF143858407; Sun, 6 Feb 2022 10:21:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCF143858407 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/89074] valid pointer equality constexpr comparison rejected Date: Sun, 06 Feb 2022 10:21:07 +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: 9.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub 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: Sun, 06 Feb 2022 10:21:07 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D89074 --- Comment #18 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:f9e900ce9b17dc7d3a3809d0b0648ebe529a87c5 commit r12-7075-gf9e900ce9b17dc7d3a3809d0b0648ebe529a87c5 Author: Jakub Jelinek Date: Sun Feb 6 11:16:29 2022 +0100 c++: Further address_compare fixes [PR89074] This patch introduces folding_cxx_constexpr, folding_initializer is used for both C and C++ initializer/constant expression folding and enables = more optimizations over what we do normally at runtime, while folding_cxx_constexpr is used only during C++ constant expression folding and disables some optimizations. The patch improves STRING_CST vs. STRING_CST folding, for folding_initializer FUNCTION_DECL vs. FUNCTION_DECL folding, disables some optimizations li= ke is_global_var !=3D is_global_var or STRING_CST vs. DECL_P for folding_cxx_constexpr etc. 2022-02-06 Jakub Jelinek PR c++/89074 PR c++/104033 * fold-const.h (folding_initializer): Adjust comment. (folding_cxx_constexpr): Declare. * fold-const.cc (folding_initializer): Adjust comment. (folding_cxx_constexpr): New variable. (address_compare): Restrict the decl vs. STRING_CST or vice versa or STRING_CST vs. STRING_CST or is_global_var !=3D is_global_var optimizations to !folding_cxx_constexpr. Punt for FUNCTION_DECLs with non-zero offsets. If folding_initializer, assume non-aliased functions have non-zero size and have differ= ent addresses. For folding_cxx_constexpr, punt on comparisons of s= tart of some object and end of another one, regardless whether it is= a decl or string literal. Also punt for folding_cxx_constexpr on STRING_CST vs. STRING_CST comparisons if the two literals could= be overlapping. * constexpr.cc (cxx_eval_binary_expression): Temporarily set folding_cxx_constexpr. * g++.dg/cpp1y/constexpr-89074-3.C: New test.=