https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68847
Bug ID: 68847 Summary: [6 Regression] ICE in cxx_eval_constant_expression on __atomic_compare_exchange (constexpr.c:3719) in c++ Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org Target Milestone: --- Hello. ICE looks similar to PR68449, but uses a different atomic and the BT is also different: $ cat tc.ii class RegionLock { template <unsigned long> void m_fn1(); int spinlock; } acquire_zero; int acquire_one; template <unsigned long> void RegionLock::m_fn1() { __atomic_compare_exchange(&spinlock, &acquire_zero, &acquire_one, false, 2, 2); } $ g++ tc.ii tc.ii: In member function ‘void RegionLock::m_fn1()’: tc.ii:7:78: internal compiler error: unexpected expression ‘(void*)((unsigned int*)(& acquire_zero))’ of kind implicit_conv_expr __atomic_compare_exchange(&spinlock, &acquire_zero, &acquire_one, false, 2, 2); ^ 0x71f657 cxx_eval_constant_expression ../../gcc/cp/constexpr.c:3719 0x72072b cxx_eval_outermost_constant_expr ../../gcc/cp/constexpr.c:3774 0x721803 maybe_constant_value_1 ../../gcc/cp/constexpr.c:3960 0x721803 maybe_constant_value(tree_node*, tree_node*) ../../gcc/cp/constexpr.c:3981 0x5e805e build_cxx_call(tree_node*, int, tree_node**, int) ../../gcc/cp/call.c:7724 0x6aca1d cp_build_function_call_vec(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc/cp/typeck.c:3596 0x6acb2e build_function_call_vec(unsigned int, vec<unsigned int, va_heap, vl_ptr>, tree_node*, vec<tree_node*, va_gc, vl_embed>*, vec<tree_node*, va_gc, vl_embed>*) ../../gcc/cp/typeck.c:3422 0x756a65 resolve_overloaded_builtin(unsigned int, tree_node*, vec<tree_node*, va_gc, vl_embed>*) ../../gcc/c-family/c-common.c:11363 0x6cf8bf finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../gcc/cp/semantics.c:2378 0x67c530 cp_parser_postfix_expression ../../gcc/cp/parser.c:6827 0x6841e0 cp_parser_unary_expression ../../gcc/cp/parser.c:7901 0x684cdb cp_parser_cast_expression ../../gcc/cp/parser.c:8578 0x6850f7 cp_parser_binary_expression ../../gcc/cp/parser.c:8679 0x685894 cp_parser_assignment_expression ../../gcc/cp/parser.c:8966 0x68855a cp_parser_expression ../../gcc/cp/parser.c:9135 0x688f10 cp_parser_expression_statement ../../gcc/cp/parser.c:10596 0x677825 cp_parser_statement ../../gcc/cp/parser.c:10447 0x6785a9 cp_parser_statement_seq_opt ../../gcc/cp/parser.c:10719 0x6786cb cp_parser_compound_statement ../../gcc/cp/parser.c:10673 0x695320 cp_parser_function_body ../../gcc/cp/parser.c:20541