From: Augustin Degomme Date: Sun, 3 Sep 2017 22:55:03 +0000 (+0200) Subject: try to get rid of some errors seen by scan-build X-Git-Tag: v3_17~166 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c4792b986c90263d97a3db8e68279f5512b65fa1 try to get rid of some errors seen by scan-build --- diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index 8808698485..2d978c90bf 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -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; diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index 2b76d0b7d1..1ea236fad5 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -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]]; } } diff --git a/src/kernel/routing/FloydZone.cpp b/src/kernel/routing/FloydZone.cpp index 7c5997237e..e680281214 100644 --- a/src/kernel/routing/FloydZone.cpp +++ b/src/kernel/routing/FloydZone.cpp @@ -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(), diff --git a/src/kernel/routing/FullZone.cpp b/src/kernel/routing/FullZone.cpp index ece81d3e50..429f07908b 100644 --- a/src/kernel/routing/FullZone.cpp +++ b/src/kernel/routing/FullZone.cpp @@ -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.", diff --git a/src/kernel/routing/RoutedZone.cpp b/src/kernel/routing/RoutedZone.cpp index fb5db13cdb..5c237168ca 100644 --- a/src/kernel/routing/RoutedZone.cpp +++ b/src/kernel/routing/RoutedZone.cpp @@ -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); diff --git a/src/xbt/mmalloc/mrealloc.c b/src/xbt/mmalloc/mrealloc.c index dfd03b81b0..aabf868be6 100644 --- a/src/xbt/mmalloc/mrealloc.c +++ b/src/xbt/mmalloc/mrealloc.c @@ -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