Hi all, I stumbled over a problem in ilist_node::getPrevNode(). It crashes when invoked for the first element in a list. It's because the Prev pointer of a first list element does not point to the sentinel but is just null. First question: Is this really a bug or am I doing something wrong? 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()? 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. Thanks, Erik
I tripped over that also, it seems like a bug to me. On Thu, Jul 10, 2014 at 5:59 AM, Erik Eckstein <eeckstein at apple.com> wrote:> Hi all, > > I stumbled over a problem in ilist_node::getPrevNode(). It crashes when > invoked for the first element in a list. > It's because the Prev pointer of a first list element does not point to > the sentinel but is just null. > > First question: Is this really a bug or am I doing something wrong? > 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()? > > 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. > > Thanks, > Erik > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140710/305d9b50/attachment.html>
OK, I'll try to fix it. As I understood from the documentation the Prev of the first element should point to the sentinel. On 10 Jul 2014, at 23:55, Reid Kleckner <rnk at google.com> wrote:> I tripped over that also, it seems like a bug to me. > > > On Thu, Jul 10, 2014 at 5:59 AM, Erik Eckstein <eeckstein at apple.com> wrote: > Hi all, > > I stumbled over a problem in ilist_node::getPrevNode(). It crashes when invoked for the first element in a list. > It's because the Prev pointer of a first list element does not point to the sentinel but is just null. > > First question: Is this really a bug or am I doing something wrong? > 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()? > > 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. > > Thanks, > Erik > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140711/00e712d9/attachment.html>