Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to get rid of some errors seen by scan-build
authorAugustin Degomme <augustin.degomme@unibas.ch>
Sun, 3 Sep 2017 22:55:03 +0000 (00:55 +0200)
committerAugustin Degomme <augustin.degomme@unibas.ch>
Sun, 3 Sep 2017 22:55:03 +0000 (00:55 +0200)
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FullZone.cpp
src/kernel/routing/RoutedZone.cpp
src/xbt/mmalloc/mrealloc.c

index 8808698..2d978c9 100644 (file)
@@ -337,20 +337,23 @@ void DijkstraZone::addRoute(sg_platf_route_cbarg_t route)
 
   // Symmetrical YES
   if (route->symmetrical == true) {
-    if (not route->gw_dst && not route->gw_src)
-      XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dstName, srcName);
-    else
-      XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, route->gw_dst->name().c_str(), srcName,
-                route->gw_src->name().c_str());
 
     xbt_dynar_t nodes   = xbt_graph_get_nodes(routeGraph_);
     xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src->id(), xbt_node_t);
     xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst->id(), xbt_node_t);
     xbt_edge_t edge     = xbt_graph_get_edge(routeGraph_, node_e_v, node_s_v);
 
-    if (edge)
-      THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, route->gw_dst->name().c_str(), srcName,
+    if (not route->gw_dst || not route->gw_src){
+      XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dstName, srcName);
+      if (edge)
+        THROWF(arg_error, 0, "Route from %s to %s already exists", dstName, srcName);
+    } else {
+      XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, route->gw_dst->name().c_str(), srcName,
+                route->gw_src->name().c_str());
+      if (edge)
+        THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, route->gw_dst->name().c_str(), srcName,
              route->gw_src->name().c_str());
+    }
 
     if (route->gw_dst && route->gw_src) {
       NetPoint* gw_tmp = route->gw_src;
index 2b76d0b..1ea236f 100644 (file)
@@ -364,8 +364,6 @@ void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_c
       route->link_list->push_back(currentRouter->blackLinks_[targetCoords[1]]);
       if (latency)
         *latency += currentRouter->blackLinks_[targetCoords[1]]->latency();
-      currentRouter = routers_[targetCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) +
-                               targetCoords[1] * numBladesPerChassis_ + targetCoords[2]];
     }
   }
 
index 7c59972..e680281 100644 (file)
@@ -140,7 +140,7 @@ void FloydZone::addRoute(sg_platf_route_cbarg_t route)
       route->gw_dst   = gw_tmp;
     }
 
-    if (not route->gw_src && not route->gw_dst)
+    if (not route->gw_src || not route->gw_dst)
       XBT_DEBUG("Load Route from \"%s\" to \"%s\"", route->dst->name().c_str(), route->src->name().c_str());
     else
       XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", route->dst->name().c_str(), route->gw_src->name().c_str(),
index ece81d3..429f079 100644 (file)
@@ -106,7 +106,7 @@ void FullZone::addRoute(sg_platf_route_cbarg_t route)
       route->gw_src   = route->gw_dst;
       route->gw_dst   = gw_tmp;
     }
-    if (route->gw_dst) // inter-zone route (to adapt the error message, if any)
+    if (route->gw_dst && route->gw_src) // inter-zone route (to adapt the error message, if any)
       xbt_assert(
           nullptr == TO_ROUTE_FULL(dst->id(), src->id()),
           "The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.",
index fb5db13..5c23716 100644 (file)
@@ -179,7 +179,7 @@ void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route)
   const char* srcName = src->cname();
   const char* dstName = dst->cname();
 
-  if (not route->gw_dst && not route->gw_src) {
+  if (not route->gw_dst || not route->gw_src) {
     XBT_DEBUG("Load Route from \"%s\" to \"%s\"", srcName, dstName);
     xbt_assert(src, "Cannot add a route from %s to %s: %s does not exist.", srcName, dstName, srcName);
     xbt_assert(dst, "Cannot add a route from %s to %s: %s does not exist.", srcName, dstName, dstName);
index dfd03b8..aabf868 100644 (file)
@@ -36,9 +36,7 @@ void *mrealloc(xbt_mheap_t mdp, void *ptr, size_t size)
   if ((char *) ptr < (char *) mdp->heapbase || BLOCK(ptr) > mdp->heapsize) {
     printf("FIXME. Ouch, this pointer is not mine, refusing to proceed (another solution would be to malloc "
            "it instead of reallocing it, see source code)\n");
-    result = mmalloc(mdp, size);
     abort();
-    return result;
   }
 
   size_t requested_size = size; // The amount of memory requested by user, for real