From 175d59ecbad5af5d583ef215c6ba9f8065266ca7 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 23 May 2013 20:19:51 -0400 Subject: [PATCH] Fix GCC version runtime changes, bug651. --- Changes | 2 ++ src/V3Cdc.cpp | 2 +- src/V3Const.cpp | 2 +- src/V3EmitC.cpp | 2 +- src/V3EmitCSyms.cpp | 4 ++-- src/V3GraphAcyc.cpp | 2 +- src/V3GraphAlg.cpp | 4 ++-- src/V3LinkLevel.cpp | 2 +- src/V3Order.cpp | 8 ++++---- 9 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Changes b/Changes index 4b04c67b8..905e2b488 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Fix arrayed input compile error, bug645. [Krzysztof Jankowski] +**** Fix GCC version runtime changes, bug651. [Jeremy Bennett] + * Verilator 3.847 2013-05-11 diff --git a/src/V3Cdc.cpp b/src/V3Cdc.cpp index 103063390..25501d52a 100644 --- a/src/V3Cdc.cpp +++ b/src/V3Cdc.cpp @@ -526,7 +526,7 @@ private: } } } - sort(report.begin(), report.end()); + stable_sort(report.begin(), report.end()); for (deque::iterator it = report.begin(); it!=report.end(); ++it) { *ofp << *it; } diff --git a/src/V3Const.cpp b/src/V3Const.cpp index b0299ba56..acf55b68c 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -1413,7 +1413,7 @@ private: for (AstNodeSenItem* senp = nodep->sensesp()->castNodeSenItem(); senp; senp=senp->nextp()->castNodeSenItem()) { vec.push_back(senp); } - sort(vec.begin(), vec.end(), SenItemCmp()); + stable_sort(vec.begin(), vec.end(), SenItemCmp()); for (vector::iterator it=vec.begin(); it!=vec.end(); ++it) { (*it)->unlinkFrBack(); } diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index 3f15b39ab..a75f4c70f 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -1717,7 +1717,7 @@ void EmitCImp::emitIntFuncDecls(AstNodeModule* modp) { } } - sort(funcsp.begin(), funcsp.end(), CmpName()); + stable_sort(funcsp.begin(), funcsp.end(), CmpName()); for (vector::iterator it = funcsp.begin(); it != funcsp.end(); ++it) { AstCFunc* funcp = *it; diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index f17d854fb..fc7f77eda 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -168,8 +168,8 @@ class EmitCSyms : EmitCBaseVisitor { varsExpand(); // Sort by names, so line/process order matters less - sort(m_scopes.begin(), m_scopes.end(), CmpName()); - sort(m_dpis.begin(), m_dpis.end(), CmpDpi()); + stable_sort(m_scopes.begin(), m_scopes.end(), CmpName()); + stable_sort(m_dpis.begin(), m_dpis.end(), CmpDpi()); // Output emitSymHdr(); diff --git a/src/V3GraphAcyc.cpp b/src/V3GraphAcyc.cpp index 0b90acb4b..54c9e52ec 100644 --- a/src/V3GraphAcyc.cpp +++ b/src/V3GraphAcyc.cpp @@ -461,7 +461,7 @@ void GraphAcyc::place() { } // Sort by weight, then by vertex (so that we completely process one vertex, when possible) - sort(edges.begin(), edges.end(), GraphAcycEdgeCmp()); + stable_sort(edges.begin(), edges.end(), GraphAcycEdgeCmp()); // Process each edge in weighted order m_placeStep = 10; diff --git a/src/V3GraphAlg.cpp b/src/V3GraphAlg.cpp index 161017bc9..dba224ad2 100644 --- a/src/V3GraphAlg.cpp +++ b/src/V3GraphAlg.cpp @@ -464,7 +464,7 @@ void V3Graph::sortVertices() { for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) { vertices.push_back(vertexp); } - std::sort(vertices.begin(), vertices.end(), GraphSortVertexCmp()); + std::stable_sort(vertices.begin(), vertices.end(), GraphSortVertexCmp()); this->verticesUnlink(); for (vector::iterator it = vertices.begin(); it!=vertices.end(); ++it) { (*it)->verticesPushBack(this); @@ -480,7 +480,7 @@ void V3Graph::sortEdges() { edges.push_back(edgep); } // Sort - std::sort(edges.begin(), edges.end(), GraphSortEdgeCmp()); + std::stable_sort(edges.begin(), edges.end(), GraphSortEdgeCmp()); // Relink edges in specified order // We know the vector contains all of the edges that were diff --git a/src/V3LinkLevel.cpp b/src/V3LinkLevel.cpp index 6bd80650c..37020c9ce 100644 --- a/src/V3LinkLevel.cpp +++ b/src/V3LinkLevel.cpp @@ -67,7 +67,7 @@ void V3LinkLevel::modSortByLevel() { } vec.push_back(nodep); } - sort(vec.begin(), vec.end(), CmpLevel()); // Sort the vector + stable_sort(vec.begin(), vec.end(), CmpLevel()); // Sort the vector for (ModVec::iterator it = vec.begin(); it != vec.end(); ++it) { AstNodeModule* nodep = *it; nodep->unlinkFrBack(); diff --git a/src/V3Order.cpp b/src/V3Order.cpp index dd9755001..38da6da7b 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -476,7 +476,7 @@ private: // elements. Up to 10 of the widest cerr<::iterator it=report.begin(); it!=report.end(); ++it) { *logp<<(*it)<