https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10837

--- Comment #26 from Josh Haberman <jhaberman at gmail dot com> ---
I have just noticed a very odd edge case though; if multiple functions in
a file make tail calls to a noreturn function, only the first one defined
in the file is a tail call!  https://godbolt.org/z/exKE7GKMW

Test case:

void noreturn_func(void) __attribute__((noreturn));

void func1() {
    __attribute__((musttail)) return noreturn_func();
}

void func2() {
    __attribute__((musttail)) return noreturn_func();
}

Expected output:

func1:
        jmp     noreturn_func
func2:
        jmp     noreturn_func

Actual output:

func1:
        jmp     noreturn_func
func2:
        sub     rsp, 8
        call    noreturn_func

Reply via email to