<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:rnk@google.com" title="Reid Kleckner <rnk@google.com>"> <span class="fn">Reid Kleckner</span></a>
</span> changed
<a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - NULL-based pointer arithmetic generates ud2"
href="https://llvm.org/bugs/show_bug.cgi?id=27255">bug 27255</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>RESOLVED
</td>
<td>REOPENED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>rnk@google.com
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>INVALID
</td>
<td>---
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - NULL-based pointer arithmetic generates ud2"
href="https://llvm.org/bugs/show_bug.cgi?id=27255#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - NULL-based pointer arithmetic generates ud2"
href="https://llvm.org/bugs/show_bug.cgi?id=27255">bug 27255</a>
from <span class="vcard"><a class="email" href="mailto:rnk@google.com" title="Reid Kleckner <rnk@google.com>"> <span class="fn">Reid Kleckner</span></a>
</span></b>
<pre>So, doing pointer arithmetic off of null may be UB in C strictly speaking, but
I think optimizing based on that at the LLVM level has soundness issues.
I would expect the following LLVM transform to be semantics preserving, but you
are saying it isn't:
%0 = ptrtoint i8* %myptr, i64
%1 = add i64 0, i64 %0
%2 = inttoptr i64 %1, i8*
%3 = load i8, i8* %2
=>
%0 = ptrtoint i8* %myptr, i64
%1 = getelementptr i8* null, i64 %0
%2 = load i8, i8* %1
Why should it matter to instcombine whether the valid pointer comes from the
base or the index of the GEP?</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>