From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 374963871016; Wed, 26 Jun 2024 20:07:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 374963871016 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1719432457; bh=UigfbwIcPJQ0Bj5nn6MpDfq4lLuRd8dCw7L+BlHg1q4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EOobB6XQnFsbpJ+zjdc5gDuOpIZ36Ud1ow4xYxVkBsxnC2roUZp+khaKcWhAmHnzr +lVj/SlmeJbQAI5gJSdaaQrvIwW12+ShiOOYmXZ6nknHgbhyFEAo8c2ZcvOI2ZMS1G CD1X5lSFXKyZdl4EYQ0klw9/+I24HoKh5QV5zfcM= From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/115639] Large variations in compilation times involving static_assert Date: Wed, 26 Jun 2024 20:07:36 +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: 15.0 X-Bugzilla-Keywords: compile-time-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek 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=3D115639 --- Comment #2 from Marek Polacek --- With static_assert(0=3D=3Dbig_calc()); // (1) we evaluate the big_calc call twice. Once, while parsing the static_assert: #0 cxx_eval_call_expression (ctx=3D0x7fffffffc3e0, t=3D, lval=3Dvc_prvalue,=20 non_constant_p=3D0x7fffffffc50f, overflow_p=3D0x7fffffffc50e) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:2801 #1 0x0000000000e45583 in cxx_eval_constant_expression (ctx=3D0x7fffffffc3e= 0, t=3D,=20 lval=3Dvc_prvalue, non_constant_p=3D0x7fffffffc50f, overflow_p=3D0x7fff= ffffc50e, jump_target=3D0x0) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:7554 #2 0x0000000000e4b6b8 in cxx_eval_outermost_constant_expr (t=3D, allow_non_constant=3Dtrue,=20 strict=3Dtrue, manifestly_const_eval=3Dmce_value::mce_unknown, constexpr_dtor=3Dfalse, object=3D) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:8852 #3 0x0000000000e4c8ee in maybe_constant_value (t=3D, decl=3D,=20 manifestly_const_eval=3Dmce_value::mce_unknown) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:9161 #4 0x0000000000e95c58 in cp_fully_fold (x=3D, manifestly_const_eval=3Dmce_value::mce_unknown) at /home/mpolacek/src/gcc/gcc/cp/cp-gimplify.cc:2852 #5 0x0000000000e95dc7 in cp_fully_fold (x=3D) at /home/mpolacek/src/gcc/gcc/cp/cp-gimplify.cc:2871 #6 0x000000000122ee78 in cp_build_binary_op (location=3D..., code=3DEQ_EXP= R, orig_op0=3D,=20 orig_op1=3D, complain=3D3) at /home/mpolacek/src/gcc/gcc/cp/typeck.cc:6669 #7 0x0000000000dc774e in build_new_op (loc=3D..., code=3DEQ_EXPR, flags=3D= 1, arg1=3D,=20 arg2=3D, arg3=3D, lookups=3D, overload=3D0x7fffffffcc30, complain=3D3) at /home/mpolacek/src/gcc/gcc/cp/call.cc:7516 and the second time while in finish_static_assert: #0 cxx_eval_call_expression (ctx=3D0x7fffffffce20, t=3D, lval=3Dvc_prvalue,=20 non_constant_p=3D0x7fffffffcf4f, overflow_p=3D0x7fffffffcf4e) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:2801 #1 0x0000000000e45583 in cxx_eval_constant_expression (ctx=3D0x7fffffffce2= 0, t=3D,=20 lval=3Dvc_prvalue, non_constant_p=3D0x7fffffffcf4f, overflow_p=3D0x7fff= ffffcf4e, jump_target=3D0x0) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:7554 #2 0x0000000000e35b6b in cxx_eval_binary_expression (ctx=3D0x7fffffffce20, t=3D, lval=3Dvc_prvalue,=20 non_constant_p=3D0x7fffffffcf4f, overflow_p=3D0x7fffffffcf4e) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:3820 #3 0x0000000000e46f1f in cxx_eval_constant_expression (ctx=3D0x7fffffffce2= 0, t=3D, lval=3Dvc_prvalue,=20 non_constant_p=3D0x7fffffffcf4f, overflow_p=3D0x7fffffffcf4e, jump_targ= et=3D0x0) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:7966 #4 0x0000000000e4b6b8 in cxx_eval_outermost_constant_expr (t=3D, allow_non_constant=3Dtrue,=20 strict=3Dtrue, manifestly_const_eval=3Dmce_value::mce_true, constexpr_dtor=3Dfalse, object=3D) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:8852 #5 0x0000000000e4c7c2 in maybe_constant_value (t=3D, decl=3D,=20 manifestly_const_eval=3Dmce_value::mce_true) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:9140 #6 0x0000000000e4ce02 in fold_non_dependent_expr (t=3D, complain=3D3, manifestly_const_eval=3Dtrue,=20 object=3D) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:9280 #7 0x00000000011dd851 in finish_static_assert (condition=3D, message=3D,=20 location=3D2147483661, member_p=3Dfalse, show_expr_p=3Dfalse) at /home/mpolacek/src/gcc/gcc/cp/semantics.cc:11887 The second time around, we're not finding the call in constexpr_call_table.=