[llvm-bugs] [Bug 41311] New: clang-analyzer-valist.Uninitialized warning on use of a copied valist
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Mar 29 11:33:21 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41311
Bug ID: 41311
Summary: clang-analyzer-valist.Uninitialized warning on use of
a copied valist
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: dcoughlin at apple.com
Reporter: juliehockett at google.com
CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org
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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190329/f685a964/attachment.html>
More information about the llvm-bugs
mailing list