[Bug tree-optimization/48837] Wrong optimization of recursive function calls

d.g.gorbachev at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun May 1 07:31:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48837

--- Comment #1 from Dmitry Gorbachev <d.g.gorbachev at gmail dot com> 2011-05-01 05:52:09 UTC ---
Simpler testcase:

=========================== 8< ===========================
__attribute__((noinline))
int baz(void)
{
  return 1;
}

inline const int& bar(const int& a, const int& b)
{
  return a ? a : b;
}

int foo(int a, int b)
{
  return a || b ? baz() : foo(bar(a, b), 1) + foo(1, 0);
}

int main(void)
{
  return foo(0, 0) != 2;
}
=========================== >8 ===========================



More information about the Gcc-bugs mailing list