From: Bill Wendling Date: Thu, 1 Jan 2009 01:14:31 +0000 (+0000) Subject: Some compilers are picky about accessing the first element of a std::vector if X-Git-Tag: android-x86-6.0-r1~1047^2~16633 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=15a83df579d934eb08f8a4e2a356812e58438beb;p=android-x86%2Fexternal-llvm.git Some compilers are picky about accessing the first element of a std::vector if there's nothing in the vector. Pacify them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61536 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/ScheduleDAGSDNodes.h b/include/llvm/CodeGen/ScheduleDAGSDNodes.h index d7f0ea49d48..b9c6428fba7 100644 --- a/include/llvm/CodeGen/ScheduleDAGSDNodes.h +++ b/include/llvm/CodeGen/ScheduleDAGSDNodes.h @@ -103,10 +103,13 @@ namespace llvm { /// SUnit *NewSUnit(SDNode *N) { #ifndef NDEBUG - const SUnit *Addr = &SUnits[0]; + const SUnit *Addr = 0; + if (SUnits.size() > 0) + Addr = &SUnits[0]; #endif SUnits.push_back(SUnit(N, (unsigned)SUnits.size())); - assert(Addr == &SUnits[0] && "SUnits std::vector reallocated on the fly!"); + assert((Addr == 0 || Addr == &SUnits[0]) && + "SUnits std::vector reallocated on the fly!"); SUnits.back().OrigNode = &SUnits.back(); return &SUnits.back(); }