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 tree-optimization/48837] Wrong optimization of recursive function calls


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 ===========================


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