We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
typedef struct { long long a, b, c; } S; S ext1(void); int ext2(int); int f() { S v = ext1(); v.a+= v.b; return ext2(v.a); }
f: # @f sub rsp, 24 mov rdi, rsp call ext1 mov rdi, qword ptr [rsp] add rdi, qword ptr [rsp + 8] mov qword ptr [rsp], rdi call ext2 add rsp, 24 ret
https://godbolt.org/z/zdr339Ke6 - gcc does a tail call, and doesn't store the result of the addition.
A related scenario is a stack-allocated value whose lifetime ends before the return, e.g.
return
typedef struct { long long a, b, c; } S; void ext1(S*); int ext2(int); int f(int a) { { S v; ext1(&v); } return ext2(a); }
https://godbolt.org/z/fz58qWcos - gcc again tail-calls when clang doesn't.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://godbolt.org/z/zdr339Ke6 - gcc does a tail call, and doesn't store the result of the addition.
A related scenario is a stack-allocated value whose lifetime ends before the
return
, e.g.https://godbolt.org/z/fz58qWcos - gcc again tail-calls when clang doesn't.
The text was updated successfully, but these errors were encountered: