https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96776
Bug ID: 96776
Summary: Missing tail call optimization when passing local
variable by reference to yet another function
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mizvekov at gmail dot com
Target Milestone: ---
Compiler explorer workspace showing the problem: https://godbolt.org/z/z8W74T
Calling `foo` with reference to local should not prevent tail calling `cont` in
this case.
Code for reference:
```
extern void foo(const int &) noexcept;
extern void cont() noexcept;
void test(int a) noexcept {
foo(a);
return cont();
}
```