From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 657DF384241B; Fri, 19 Mar 2021 17:38:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 657DF384241B From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99456] [11 regression] ABI breakage with some static initialization Date: Fri, 19 Mar 2021 17:38:02 +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: 11.0 X-Bugzilla-Keywords: ABI, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 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: Fri, 19 Mar 2021 17:38:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99456 --- Comment #14 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:82bb66730bc42b8694fdebef607ea6e49e8496bf commit r11-7740-g82bb66730bc42b8694fdebef607ea6e49e8496bf Author: Jakub Jelinek Date: Fri Mar 19 18:36:56 2021 +0100 c++: Only reject reinterpret casts from pointers to integers for manifestly_const_eval evaluation [PR99456] My PR82304/PR95307 fix moved reinterpret cast from pointer to integer diagnostics from cxx_eval_outermost_constant_expr where it caught invalid code only at the outermost level down into cxx_eval_constant_expression. Unfortunately, it regressed following testcase, we emit worse code including dynamic initialization of some vars. While the initializers are not constant expressions due to the reinterpret_cast in there, there is no reason not to fold them as an optimization. I've tried to make this dependent on !ctx->quiet, but that regressed two further tests, and on ctx->strict, which regressed other tests, so this patch bases that on manifestly_const_eval. The new testcase is now optimized as much as it used to be in GCC 10 and the only regression it causes is an extra -Wnarrowing warning on vla22.C test on invalid code (which the patch adjusts). 2021-03-19 Jakub Jelinek PR c++/99456 * constexpr.c (cxx_eval_constant_expression): For CONVERT_EXPR = from INDIRECT_TYPE_P to ARITHMETIC_TYPE_P, when !ctx->manifestly_const_eval don't diagnose it, set *non_constant_p nor return t. * g++.dg/opt/pr99456.C: New test. * g++.dg/ext/vla22.C: Expect a -Wnarrowing warning for c++11 and later.=