<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 - CallGraph failed to identify some direct calls' targets"
href="https://bugs.llvm.org/show_bug.cgi?id=32450">32450</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>CallGraph failed to identify some direct calls' targets
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</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>enhancement
</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>aquach1@binghamton.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Attached are LLVM assembly and bitcode files to reproduce the problem. I also
attached the callgraph retrieved from opt. They are compiled from musl libc
version 1.1.16 with LLVM LTO.
The callgraph generated by opt from this bitcode shows only 1 direct callee of
function __fwritex.
Call graph node for function: '__fwritex'<<0x6784590>> #uses=5
CS<0x61b65e0> calls external node
CS<0x61b7080> calls external node
CS<0x61b8260> calls external node
CS<0x61b8d20> calls function 'memcpy'
However, source code says there is another direct callsite to __towrite. This
is compiled into a direct call in the result binary as well.
size_t __fwritex(const unsigned char *restrict s, size_t l, FILE *restrict f)
{
size_t i=0;
if (!f->wend && __towrite(f)) return 0;
if (l > f->wend - f->wpos) return f->write(f, s, l);
if (f->lbf >= 0) {
/* Match /^(.*\n|)/ */
for (i=l; i && s[i-1] != '\n'; i--);
if (i) {
size_t n = f->write(f, s, i);
if (n < i) return n;
s += i;
l -= i;
}
}
memcpy(f->wpos, s, l);
f->wpos += l;
return l+i;
}
Another example is function _flushlbf where the direct call to fflush does not
show up in its callgraph. This also appears as a direct call in executable.
void _flushlbf(void)
{
fflush(0);
}
Call graph node for function: '_flushlbf'<<0x6782160>> #uses=1
CS<0x6151c40> calls external node</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>