Bug 21093 - missed tail call optimization when local address could escape
Summary: missed tail call optimization when local address could escape
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.1.0
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on: 23384
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-18 19:53 UTC by Andrew Pinski
Modified: 2021-08-22 02:14 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-08-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2005-04-18 19:53:58 UTC
Missed tail call optimization when local address could escape but not on the condition:
void f(void);
void f1(int *);

void g(int i, int j)
{
  if (j)
    return f();
  return f1(&i);
}

This might be a reduced testcase from fold_binary to fold_build2 where we have this issue, but I have 
not looked through all of the conditionals to see if this is true.
Comment 1 Andrew Pinski 2005-05-07 22:47:06 UTC
Confirmed.
Comment 2 Andrew Pinski 2005-09-21 02:20:00 UTC
Very much related to PR 23384.
Comment 3 Andrew Pinski 2021-08-22 02:14:48 UTC
I see clang/LLVM can do this optimization.