https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84824
--- Comment #5 from linzj ---
Change the function call to printf to asm like:
int main() {
// printf("%d", getFunc(1)(1, 1));
asm volatile(""
:
: "r"(getFunc(1)(1, 1)));
return 0;
}
Will generate the concise code.
I think
# USE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84824
--- Comment #4 from Marc Glisse ---
Probably related to PR59948, PR81000, etc. (I didn't look closely)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84824
--- Comment #3 from linzj ---
From the function destructor
~_Function_base()
{
if (_M_manager)
_M_manager(_M_functor, _M_functor, __destroy_functor);
}
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84824
--- Comment #2 from linzj ---
Okay, it's std::_Function_base::_Base_manager
>::_M_manager(std::_Any_data &, const std::_Any_data &,
std::_Manager_operation) (__dest=..., __source=...,
__op=std::__destroy_functor)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84824
--- Comment #1 from linzj ---
According to the tree generated, the problem is sourced from fail to remove the
lambda function call. But the constant value is deduced and propagated. In case
of the side effect?