-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature
Description
int base(int);
int ok1() { return base(5); }
int ok2(int x, int y /* unused */) { return base(x); }
ok1(): # @ok1()
mov edi, 5
jmp base(int)@PLT # TAILCALL
ok2(int, int): # @ok2(int, int)
jmp base(int)@PLT # TAILCALL
So clearly LLVM can apply tail call optimization for these cases. But Clang does not think so and emits errors for these cases:
int f1() { [[clang::musttail]] return base(5); }
int f2(int x, int y /* unused */) { [[clang::musttail]] return base(5); }
error: cannot perform a tail call to function 'base' because its signature is incompatible with the calling function
int f1() { [[clang::musttail]] return base(5); }
^
error: cannot perform a tail call to function 'base' because its signature is incompatible with the calling function
int f2(int x, int y /* unused */) { [[clang::musttail]] return base(5); }
DianaNites
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature