https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109528
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Summary|Calling exit() at the end |function with _Noreturn
|of function triggers |triggers infinite recursion
|infinite recursion warning |warning while using the
| |attribute does not
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-04-15
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
#if 1
#define noreturn _Noreturn
#else
#define noreturn [[gnu::noreturn]]
#endif
struct tree_node {
unsigned nr_children;
char name[16];
struct tree_node *children;
};
noreturn void fork_my_tree(const struct tree_node* pRoot)
{
for (unsigned i = 0u; i < pRoot->nr_children; i++)
fork_my_tree(pRoot->children + i);
__builtin_exit(0);
}
```
Changing `#if 1` to `#if 0` fixes the warning.