https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111708
--- Comment #3 from Kirill Frolov <k.frolov at samsung dot com> --- Looks like example demonstrates undefined behaviour. This article (https://wiki.sei.cmu.edu/confluence/display/c/DCL36-C.+Do+not+declare+an+identifier+with+conflicting+linkage+classifications) contains table, which shows that I can use "extern" keyword in second declaration to refer symbol with internal linkage. So I fixed the source: static int f(int); int main(int argc, const char *argv[]) { (void)argv; return f(argc); } static int f(int f) { int x = f; { extern int f(int); if (x < 1) return 0; else return f(x - 1); } } The problem still persist. See an example: https://godbolt.org/z/reGbM67Kj GCC still references external function "f", but I expect that internal function must be referenced instead.