<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 --- - basicaa claims no alias when there is"
href="http://llvm.org/bugs/show_bug.cgi?id=15967">15967</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>basicaa claims no alias when there is
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>Global Analyses
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>moo321@mailinator.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>test.s:
target datalayout = "e"
%struct.foo = type { i32, i32 }
define i32 @main() {
%t = alloca %struct.foo, align 4
%1 = getelementptr inbounds %struct.foo* %t, i32 0, i32 0
store i32 1, i32* %1, align 4
%2 = getelementptr inbounds %struct.foo* %t, i64 1
%3 = bitcast %struct.foo* %2 to i8*
%4 = getelementptr inbounds i8* %3, i32 -1
store i8 0, i8* %4
%5 = getelementptr inbounds i8* %4, i32 -1
store i8 0, i8* %5
%6 = getelementptr inbounds i8* %5, i32 -1
store i8 0, i8* %6
%7 = getelementptr inbounds i8* %6, i32 -1
store i8 0, i8* %7
%8 = getelementptr inbounds i8* %7, i32 -1
store i8 0, i8* %8
%9 = getelementptr inbounds i8* %8, i32 -1
store i8 0, i8* %9
%10 = getelementptr inbounds i8* %9, i32 -1
store i8 0, i8* %10
%11 = getelementptr inbounds i8* %10, i32 -1
store i8 0, i8* %11
%12 = load i32* %1, align 4
ret i32 %12
}
This is the source program:
struct foo {
int a;
int fill;
};
int main() {
foo t;
t.a = 1;
char*p = (char*)(&t+1);
for (int i=0;i<sizeof(t);++i) *--p = 0;
return t.a;
}
Running 'opt test.s -S -basicaa -gvn' transforms the ret to 'ret i32 1'.
'clang -O2 test.cpp -S' produces:
define i32 @main() nounwind uwtable {
ret i32 1
}
The program is supposed to return 0.
The error seems to be in lib/Analysis/BasicAliasAnalysis.cpp in the function
BasicAliasAnalysis::aliasGEP.
It seems to figure that
%11 = getelementptr inbounds i8* %10, i32 -1
and
%t = alloca %struct.foo, align 4
cannot possibly alias each other, because %11 is derived from
%2 = getelementptr inbounds %struct.foo* %t, i64 1
and those can not alias each other, or something along those lines.</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>