This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/84824] DCE fails to remove dead code of std::function constructor


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]