<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>I looked at this and found two problems:</div><div><br></div><div>1) Many list instantiations do not initialise their sentinel, like it should be done in ilist_sentinel_traits:: ensureHead()</div><div>This can be fixed easily. Even in ilist.h, so that not all usages of ilist must be modified.</div><div><br></div><div>2) Some list instantiations use only a ilist_half_node instead of a ilist_node for the sentinel.</div><div>This is OK for all list operations, except getPrevNode() and getNextNode().</div><div>I assume that ilist_half_node is used to save space (the next-pointer).</div><div><br></div><div>Now the question is: should all sentinels be changed to ilist_node. This will fix getPrevNode() and getNextNode()?</div><div>Or should it stay like it is and specify that getPrevNode()/getNextNode()  cannot be used on lists which have a ilist_half_node sentinel?</div><div><br></div><div>Thanks,</div><div>Erik </div><br><div><div>On 11 Jul 2014, at 17:47, Erik Eckstein <<a href="mailto:eeckstein@apple.com">eeckstein@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">OK, I'll try to fix it.<div>As I understood from the documentation the Prev of the first element should point to the sentinel.<br><div><br><div><div>On 10 Jul 2014, at 23:55, Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">I tripped over that also, it seems like a bug to me.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 10, 2014 at 5:59 AM, Erik Eckstein <span dir="ltr"><<a href="mailto:eeckstein@apple.com" target="_blank">eeckstein@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I stumbled over a problem in ilist_node::getPrevNode(). It crashes when invoked for the first element in a list.<br>
It's because the Prev pointer of a first list element does not point to the sentinel  but is just null.<br>
<br>
First question: Is this really a bug or am I doing something wrong?<br>
Second question: If it is a bug, what should be the correct behaviour? Either change insert() to let Prev of the first element really point to the sentinel or just change getPrevNode()?<br>
<br>
I don't really need getPrevNode() because I can also use iterators but if this is really a bug, I think it should be fixed.<br>
<br>
Thanks,<br>
Erik<br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div>
</blockquote></div><br></div></div></div>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br></body></html>