<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 --- - possible wrong code with volatile and lto"
href="http://llvm.org/bugs/show_bug.cgi?id=17623">17623</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>possible wrong code with volatile and lto
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</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>lto
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>octoploid@yandex.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>Playing with csmith I came across several possible wrong code bugs with lto.
Two examples:
1)
markus@x4 clang_bugs % cat test_lto_crash.i
int a, b, e;
int *c;
int **volatile d = &c;
int main() {
for (; a <= 0; a++) {
e = 0;
*d = &e;
if (*c)
return 0;
}
return 0;
}
markus@x4 clang_bugs % clang -O0 -flto test_lto_crash.i && ./a.out
markus@x4 clang_bugs % clang -O2 -flto test_lto_crash.i && ./a.out
[1] 29647 segmentation fault ./a.out
markus@x4 clang_bugs % clang -O2 test_lto_crash.i && ./a.out
markus@x4 clang_bugs % gcc -O2 -flto test_lto_crash.i && ./a.out
markus@x4 clang_bugs %
2)
markus@x4 clang_bugs % cat test_lto_wrong.i
int a, b;
int *volatile c = &b;
int main() {
a = 1;
for (; a; a--) {
*c = 1;
b |= 4;
}
printf("%d\n", b);
return 0;
}
markus@x4 clang_bugs % clang -w -O2 test_lto_wrong.i && ./a.out
5
markus@x4 clang_bugs % clang -w -O0 -flto test_lto_wrong.i && ./a.out
5
markus@x4 clang_bugs % gcc -w -O2 -flto test_lto_wrong.i && ./a.out
5
markus@x4 clang_bugs % clang -w -O2 -flto test_lto_wrong.i && ./a.out
4
markus@x4 clang_bugs %</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>