<html>
<head>
<base href="https://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_ASSIGNED "
title="ASSIGNED --- - static_cast() of sentinel value in LLVM intrusive lists is Undefined Behavior"
href="https://llvm.org/bugs/show_bug.cgi?id=26753">26753</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>static_cast() of sentinel value in LLVM intrusive lists is Undefined Behavior
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>ASSIGNED
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>dexonsmith@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>llvm-bugs@justinbogner.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Many of our iplist classes (MachineBasicBlock, MemoryAccess) do something like
this:
template <class T> ListNode { T *prev, *next; };
template <class T> struct List {
ListNode<T> Sentinel;
T *Head = static_cast<T *>(&Sentinel);
void ensureHead() {}
};
Because of iterators have pointers to `T` instead of `ListNodeBase`, this
exposes UB.
See here for more details:
<a href="http://lists.llvm.org/pipermail/llvm-dev/2015-October/091115.html">http://lists.llvm.org/pipermail/llvm-dev/2015-October/091115.html</a></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>