<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 - warning: format string is not a string literal with default parameter"
href="https://bugs.llvm.org/show_bug.cgi?id=41153">41153</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>warning: format string is not a string literal with default parameter
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>Mario.Klebsch@ime-actia.de
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>The following code produces a warning, which IMHO is wrong:
mkl@C707 ~ $ cat clang-bug.cpp
void Log(const char* str = " ", ...) __attribute__ ((format (printf, 1, 2)));
void Bug()
{
Log();
}
mkl@C707 ~ $ /usr/lib/llvm/9/bin/clang++ -c clang-bug.cpp
warning: format string is not a string literal (potentially insecure)
[-Wformat-security]
note: treat the string as an argument to avoid this
1 warning generated.
mkl@C707 ~ $ /usr/lib/llvm/9/bin/clang++ --version
clang version 9.0.0 (/var/tmp/portage/sys-devel/clang-9999/work/x/y/clang-9999
b4f4320de39f9a7227af0a8374c6739af6969f7a)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/9/bin
mkl@C707 ~ $
The warning doesn’t include a line number and disappears when I add the default
argument to Log().</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>