<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - InitPreprocessor.cpp:InitializePredefinedMacros constructs a version string from out-of-scope memory"
href="https://llvm.org/bugs/show_bug.cgi?id=24684">24684</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>InitPreprocessor.cpp:InitializePredefinedMacros constructs a version string from out-of-scope memory
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.6
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Sun
</td>
</tr>
<tr>
<th>OS</th>
<td>Solaris
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>stefan.teleman@oracle.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>This is a placeholder bug for a patch I will be submitting very shortly.
In file ${top_srcdir}/tools/clang/lib/Frontend/InitPreprocessor.cpp,
static function InitializePredefinedMacros() does the following, at
line 472:
Builder.defineMacro("__clang_version__",
"\"" CLANG_VERSION_STRING " "
+ getClangFullRepositoryVersion() + "\"");
The second llvm::Twine argument to MacroBuilder::defineMacro is
constructed from a concatenation of string literals plus the return
value of getClangFullRepositoryVersion(), which is a std::string.
This std::string goes out-of-scope, and the resulting clang version string
contains invalid memory. This shows up in Valgrind on Linux, and causes
SEGV on Solaris SPARC.
Follow-up patch very shortly.</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>