<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:vsk@apple.com" title="Vedant Kumar <vsk@apple.com>"> <span class="fn">Vedant Kumar</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Compiler crash"
href="https://bugs.llvm.org/show_bug.cgi?id=32416">bug 32416</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>REOPENED
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>vsk@apple.com
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Compiler crash"
href="https://bugs.llvm.org/show_bug.cgi?id=32416#c6">Comment # 6</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Compiler crash"
href="https://bugs.llvm.org/show_bug.cgi?id=32416">bug 32416</a>
from <span class="vcard"><a class="email" href="mailto:vsk@apple.com" title="Vedant Kumar <vsk@apple.com>"> <span class="fn">Vedant Kumar</span></a>
</span></b>
<pre>There doesn't seem to be a compiler bug here: this code violates C's aliasing
rules. A load from a i8* isn't allowed to alias a load from a struct.typeB, so
the compiler throws away the pointer comparison.
Here's the IR:
define i32 @main() local_unnamed_addr #0 {
%1 = tail call i8* @calloc(i64 1, i64 64)
%2 = getelementptr inbounds i8, i8* %1, i64 64
%3 = getelementptr inbounds %struct.typeB, i8* %1, i64 4
%4 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8],
[19 x i8]* @.str, i64 0, i64 0), i8* %2, %struct.typeB* %3) #3
tail call void @__assert_rtn(i8* getelementptr inbounds ([6 x i8], [6 x i8]*
@__func__.init1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]*
@.str.1, i64 0, i64 0), i32 34, i8* getelementptr inbounds ([27 x i8], [27 x
i8]* @.str.2, i64 0, i64 0)) #4
unreachable
}</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>