<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 - BasicAA incorrectly assumes different address spaces don't alias"
href="https://bugs.llvm.org/show_bug.cgi?id=33878">33878</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>BasicAA incorrectly assumes different address spaces don't alias
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>Keywords</th>
<td>miscompilation
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Global Analyses
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nunoplopes@sapo.pt
</td>
</tr>
<tr>
<th>CC</th>
<td>davide@freebsd.org, dberlin@dberlin.org, gil.hur@sf.snu.ac.kr, hfinkel@anl.gov, jeehoon.kang@sf.snu.ac.kr, juneyoung.lee@sf.snu.ac.kr, llvm-bugs@lists.llvm.org, regehr@cs.utah.edu, sanjoy@playingwithpointers.com
</td>
</tr></table>
<p>
<div>
<pre>BasicAA assumes that pointers of different address spaces can't alias. This is
not true is general, though.
in function BasicAAResult::aliasCheck():
if (O1 != O2) {
// Most objects can't alias null.
if ((isa<ConstantPointerNull>(O2) && isKnownNonNull(O1)) ||
(isa<ConstantPointerNull>(O1) && isKnownNonNull(O2)))
return NoAlias;
There are two bugs here:
- if O1 is null, and O2 is non-null, but they are in different address spaces,
then nothing can be concluded (unless we add target-specific hooks to tell us
that information).
- isKnownNonNull assumes alloca produces a non-null result, which is not true
in general for address space != 0:
bool llvm::isKnownNonNull(const Value *V) {
assert(V->getType()->isPointerTy() && "V must be pointer type");
// Alloca never returns null, malloc might.
if (isa<AllocaInst>(V)) return true;
(...)
}</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>