[clang] [clang] Lifetime of locals must end before musttail call (PR #109255)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 20 01:33:13 PDT 2024


================
@@ -637,6 +637,11 @@ return value must be trivially destructible. The calling convention of the
 caller and callee must match, and they must not be variadic functions or have
 old style K&R C function declarations.
 
+The lifetimes of all local variables and function parameters end immediately
+before the call to the function. This means that it is undefined behaviour to
+pass a pointer or reference to a local variable to the called function, which
+is not the case without the attribute.
----------------
hokein wrote:

nit: maybe mention that clang will give a diagnostic on this case.

https://github.com/llvm/llvm-project/pull/109255


More information about the cfe-commits mailing list