<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68746>68746</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
no lifetime markers emitted for compound literals
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c,
clang:codegen
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
nickdesaulniers
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nickdesaulniers
</td>
</tr>
</table>
<pre>
C23 6.2.4 Storage durations of objects:
> 5 An object whose identifier is declared with no linkage and without the storage-class specifier static
has automatic storage duration, as do some compound literals. The result of attempting to indirectly
access an object with automatic storage duration from a thread other than the one with which the
object is associated is implementation-defined.
6 For such an object that does not have a variable length array type, its lifetime extends from entry
into the block with which it is associated until execution of that block ends in any way
as noted here: https://reviews.llvm.org/D74094#4647616
example:
```c
struct foo { long long x, y, z; int w; };
void bar (struct foo);
void baz (void) {
{
bar((struct foo){
.x = 42,
.y = 25,
.z = 77,
});
}
{
bar((struct foo){
.x = 42,
.y = 25,
.z = 77,
});
}
}
```
we should emit lifetime markers for those `alloca`s as we should be able to reuse their stack slots. That should help us reduce stack usage for C codebases. cc @rjmccall @ilovepi
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVd1y6jgMfhpzo2kmOCHARS76s7zAnhdQbIX41LEZSymlT7_jhB447dmb3QwTbMn69EmRZGR2x0DUqs2T0jo482qJcfLBUWKltdq8rHCSIab2i3LVRXtpn3UFTaGLGv6WmPBIYKeE4mJgiD3E7icZYVU9qvJFlZ_v6i_YwGO4quE8RCZwloK43lECx2DJeExk4exkgBDBu_Ca8TEssjgJyEDAi98H45EZ-ERmwWBBcWZxOCADThLHLPq0-MVU6WdABhuB40hg4niKU7DgnVBCzwX8GAgS8eQlB4UiNJ7EhSNIBBesS2TEXxZfaAwxA96iywH8u3foUxwBQYZEaCHKQAlkwDBHFwMtAOfBmSGLFi9XbMeAzNE4FLJ558aTp5GCzNgPl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