Issue 58113
Summary clang fails to inline recursive function while gcc succeeds
Labels new issue
Assignees
Reporter jrmuizel
    ```c++

#include <stdlib.h>

struct Foo {
    Foo * next;
};

static void drop_in_place(Foo* f) {
    if (f->next) { drop_in_place(f->next); }
    free(f);
}

void free_foo(Foo *f) {
    while (f) {
        Foo * next = f->next;
        f->next = 0;
        drop_in_place(f);
        f = next;
    }
}
```

See https://godbolt.org/z/YT4soroz9

GCC is able to inline `drop_in_place` and avoiding calling it recursively.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to