<html>
<head>
<base href="http://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 --- - name of parameter Alloca is lost in LLVM_ENABLE_ASSERTIONS=OFF build of clang"
href="http://llvm.org/bugs/show_bug.cgi?id=17303">17303</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>name of parameter Alloca is lost in LLVM_ENABLE_ASSERTIONS=OFF build of clang
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kcc@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>chandlerc@gmail.com, llvmbugs@cs.uiuc.edu, samsonov@google.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>AddressSanitizer relies on the AllocaInst name to produce informative results
for stack-buffer-overflow and stack-use-after-return bugs.
For local variables the AllocaInstr always has a name, whether the build
has LLVM_ENABLE_ASSERTIONS=OFF or ON:
void foo(int *a);
void bar() {
int ABCDE;
foo(&ABCDE);
}
% clang++ -O -S -o - -emit-llvm stack2.cc | grep alloca
%ABCDE = alloca i32, align 4
% noassert_clang++ -O -S -o - -emit-llvm stack2.cc | grep alloca
%ABCDE = alloca i32, align 4
But for parameters the AllocaInst has a name only with assertion
LLVM_ENABLE_ASSERTIONS=ON,
so with the release clang build AddressSanitizer produces a less informative
report.
void bar(int *a);
void foo(int ABC) {
bar(&ABC);
}
% clang++ -O -S -o - -emit-llvm param.cc | grep alloca
%ABC.addr = alloca i32, align 4
% noassert_clang++ -O -S -o - -emit-llvm param.cc | grep alloca
%1 = alloca i32, align 4
IMHO, the names in AllocaInst should be present in all builds, and a very
simple patch is sufficient:
--- lib/CodeGen/CGExpr.cpp (revision 191075)
+++ lib/CodeGen/CGExpr.cpp (working copy)
@@ -52,8 +52,6 @@
/// block.
llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty,
const Twine &Name) {
- if (!Builder.isNamePreserving())
- return new llvm::AllocaInst(Ty, 0, "", AllocaInsertPt);
return new llvm::AllocaInst(Ty, 0, Name, AllocaInsertPt);
}
Chandler however thinks that we need to extract the names from debug info
and never rely on the SSA variable names.
This is potentially doable, but will require a special subset of -g to
be always on with asan/msan, which is quite a bit of maintenance work
compared to a very simple patch above.
Thoughts?</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>