From 19564e3d83c9c3cdf908005c91bad13d26b5cedf Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Tue, 30 May 2006 18:04:34 +0000 Subject: [PATCH] When a priority_queue is empty, the behavior of top() operator is non-deterministic. Returns NULL when it's empty! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28560 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp index c9aa18a342e..ad8ed5aaf97 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp @@ -356,6 +356,7 @@ public: } SUnit *pop() { + if (empty()) return NULL; SUnit *V = Queue.top(); Queue.pop(); return V;