<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang-analyzer-valist.Uninitialized warning on use of a copied valist"
href="https://bugs.llvm.org/show_bug.cgi?id=41311">41311</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-analyzer-valist.Uninitialized warning on use of a copied valist
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Static Analyzer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>dcoughlin@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>juliehockett@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dcoughlin@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>When running the clang-analyzer checks under clang-tidy, the
clang-analyzer-valist.Uninitialized warning is firing on a valist copied using
va_copy().
Command: clang-tidy --checks="-*,clang-analyzer-*" example.cpp
Minimal example.cpp:
#include <stdarg.h>
#include <stdio.h>
void StringVPrintf(const char* format, va_list ap) {
char stack_buf[1024u];
va_list ap_copy;
va_copy(ap_copy, ap);
vsnprintf(stack_buf, 1024u, format, ap_copy);
va_end(ap_copy);
}
Clang-tidy warning:
example.cpp:8:5: warning: Function 'vsnprintf' is called with an uninitialized
va_list argument [clang-analyzer-valist.Uninitialized]
vsnprintf(stack_buf, 1024u, format, ap_copy);
^
example.cpp:8:5: note: Function 'vsnprintf' is called with an uninitialized
va_list argument</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>