[LLVMdev] ilist::getPrevNode asserts on list head

Carlos Sánchez de La Lama carlos.delalama at urjc.es
Mon Nov 14 03:32:41 PST 2011


Hi all,

I am finding a SEGFAULT in one of my passes when using getPrevNode on an
instruction that is the only one in a BasicBlock. I was expecting
getPrevNode to return 0 in that case (as per docs), but it breaks.

I guess the code in in ilist_node.h:

NodeTy *getPrevNode() {
  NodeTy *Prev = this->getPrev();
 
  // Check for sentinel.
  if (!Prev->getNext())
    return 0;

  return Prev;
}

would need to check if Prev is NULL before calling Prev->getNext().

BR

Carlos





More information about the llvm-dev mailing list