<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/108773>108773</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[TySan] Varargs stack use doesn't set shadow, leading to strange reports
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tavianator
</td>
</tr>
</table>
<pre>
Trying out #76261, this program with a variadic function:
```c
#include <stdarg.h>
#include <stdio.h>
void foo(void) {
long array[64];
for (int i = 0; i < 64; ++i) {
array[i] = i;
}
printf("%p\n", array);
}
void bar(int first, ...) {
va_list args;
va_start(args, first);
va_arg(args, char *);
va_end(args);
}
int main(void) {
foo();
bar(0, "");
}
```
Gives a strange report:
```console
tavianator@tachyon $ ~/code/llvm/llvm-project/build/bin/clang -g -fsanitize=type foo.c -o foo
tavianator@tachyon $ ./foo
0x7ffd254f1130
==231524==ERROR: TypeSanitizer: type-aliasing-violation on address 0x7ffd254f1268 (pc 0x55b385ac9008 bp 0x7ffd254f1170 sp 0x7ffd254f1110 tid 231524)
READ of size 8 at 0x7ffd254f1268 with type any pointer accesses an existing object of type long
#0 0x55b385ac9007 in bar /home/tavianator/code/bfs/foo.c:15:2
```
CC: @gbMattN
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VM2O4zYMfhrmQsSQJTu2Dz7kZ9JTW2B20OuClmVbrSMZkpKd7KHPXshJZrLpZoHAYiT-fuRH8l73Rqka8g3kuwUdw2BdHeikyVCwbtHY9ly_ubM2PdpjQOCiWPFVCnyLYdAeJ2d7Rwf8psOAhCdymlotsTsaGbQ1INbAdsBu3xW7_OT1PxfayPHYKgSx9aEl1ycDiJcnz9rev87fk9UtdtYCL6MIvEIoNjeNarSmR3KOzpBvVhnkOxCfr511CLzUJqBGEDtkIDazuMVVFmXgG-Ab_egWWHVzqiHfzbb63jMUuw95ctqEDngJnAPPJ8i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