<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 - Crash in FindLastStoreBRVisitor after false positive found by alpha.core.CallAndMessageUnInitRefArg"
href="https://bugs.llvm.org/show_bug.cgi?id=40625">40625</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Crash in FindLastStoreBRVisitor after false positive found by alpha.core.CallAndMessageUnInitRefArg
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>7.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>Static Analyzer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>dcoughlin@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>adam.balogh@ericsson.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dcoughlin@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The checker alpha.core.CallAndMessageUnInitRefArg finds a false positive in the
following code, thereafter there is an assertion in FindLastStoreBRVisitor. If
assertions are disabled, the code sometimes segfaults.
```
const int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
void f(const int *begin, const int *end) {
int sum = 0;
for (const int *p = begin; p != end; ++p) {
sum += *p;
}
}
typedef const int intarray[10];
void g(const intarray &arrr) {
f(arrr, arrr+sizeof(arrr));
}
void h() {
g(arr);
}
```
The checker considers the second argument to the call for `f()` in `g()` as
unitialized (false positive), then the visitor tries to cast the declaration of
`arr` to parameter declaration which fails, because it is not a parameter,
`arrr` is a parameter passed by reference and in the actual call from `h()` the
parameter `arrr` is a reference to `arr`.
The bug is also present in 8.0 release candidate and the current trunk.</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>