<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 - memchr("", 0, 1) optimized incorrectly"
href="https://bugs.llvm.org/show_bug.cgi?id=32124">32124</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>memchr("", 0, 1) optimized incorrectly
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>4.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>alex@crichton.co
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>We've got an upstream rust-lang/rust bug at
<a href="https://github.com/rust-lang/rust/issues/40165">https://github.com/rust-lang/rust/issues/40165</a> which is exhibiting some odd
behavior! I've managed to reduce it to a small snippet of IR which optimizes
oddly:
@s = internal constant [1 x i8] [i8 0], align 1
define i8* @foo() {
entry-block:
%0 = tail call i8* @memchr(i8* getelementptr ([1 x i8], [1 x i8]* @s, i64 0,
i64 0), i32 0, i64 1)
ret i8* %0
}
declare i8* @memchr(i8*, i32, i64)
When optimized,that entire function optimizes to returning null, but I'd expect
it to return @s itself (as the first byte is zero)</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>