[Bug c++/84824] DCE fails to remove dead code of std::function constructor
manjian2006 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 12 08:56:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84824
--- Comment #5 from linzj <manjian2006 at gmail dot com> ---
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 = anything
# CLB = anything
printfD.984 ("%d", _1);
Force the artifact anonymous auto variable to escape the current scope.
More information about the Gcc-bugs
mailing list