<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 --- - static analyzer not deal with VLA checking well..."
href="https://llvm.org/bugs/show_bug.cgi?id=27923">27923</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>static analyzer not deal with VLA checking well...
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>release blocker
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Static Analyzer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>kremenek@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>humeafo@gmail.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>clang -cc1 -analyze -analyzer-checker=alpha
llvm/tools/clang/test/Analysis/outofbound-notwork.c
no expected warnings emmited, after investigation the VLA tracking is not well
dealt with.
void sizeof_vla(int a) {
if (a == 5) {
char x[a];
int y[sizeof(x)];
y[4] = 4; // no-warning
y[5] = 5; // expected-warning{{out-of-bound}}
}
}
to get x's extent, I use
static SVal getExtentVal(const SubRegion* R, SValBuilder& SB, CheckerContext
&checkerContext) {
if(auto TR = dyn_cast<const TypedValueRegion>(R)) {
if (isa<VariableArrayType>(TR->getValueType())) {
Expr* ext = cast<VariableArrayType>(TR->getValueType())->getSizeExpr();
ext->dump();
return checkerContext.getSVal(ext);
}
}
return R->getExtent(SB);
}
to get the symbolic extent of a, but not succeed, am I wrong or it's a defect
of the SA engine?</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>