Skip to content

Commit

Permalink
trying to fix null-dereference warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
soheilshahrouz committed Jan 18, 2025
1 parent 37c3ce7 commit e8eeed3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ else()
"-Wcast-align" #Warn if a cast causes memory alignment changes
"-Wshadow" #Warn if local variable shadows another variable
"-Wformat=2" #Sanity checks for printf-like formatting
"-Wno-format-nonliteral" # But don't worry about non-literal formtting (i.e. run-time printf format strings)
"-Wno-format-nonliteral" # But don't worry about non-literal formatting (i.e. run-time printf format strings)
"-Wlogical-op" #Checks for logical op when bit-wise expected
"-Wmissing-declarations" #Warn if a global function is defined with no declaration
"-Wmissing-include-dirs" #Warn if a user include directory is missing
Expand All @@ -178,10 +178,10 @@ else()
"-Wduplicated-cond" #Warn about identical conditions in if-else chains
"-Wduplicated-branches" #Warn when different branches of an if-else chain are equivalent
"-Wnull-dereference" #Warn about null pointer dereference execution paths
"-Wuninitialized" #Warn about unitialized values
"-Wuninitialized" #Warn about uninitialized values
"-Winit-self" #Warn about self-initialization
"-Wcatch-value=3" #Warn when catch statements don't catch by reference
"-Wextra-semi" #Warn about redudnant semicolons
"-Wextra-semi" #Warn about redundant semicolons
"-Wimplicit-fallthrough=3" #Warn about case fallthroughs, but allow 'fallthrough' comments to suppress warnings
#GCC-like optional
#"-Wsuggest-final-types" #Suggest where 'final' would help if specified on a type methods
Expand Down
8 changes: 6 additions & 2 deletions vpr/src/place/grid_tile_lookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ GridTileLookup::GridTileLookup() {
const auto& device_ctx = g_vpr_ctx.device();
const int num_layers = device_ctx.grid.get_num_layers();

//Will store the max number of tile locations for each logical block type
max_placement_locations.resize(device_ctx.logical_block_types.size());
if (device_ctx.logical_block_types.empty()) {
throw std::runtime_error("Logical block types are empty.");
} else {
// Will store the max number of tile locations for each logical block type
max_placement_locations.resize(device_ctx.logical_block_types.size());
}

for (const auto& type : device_ctx.logical_block_types) {
vtr::NdMatrix<int, 3> type_count({static_cast<unsigned long>(num_layers), device_ctx.grid.width(), device_ctx.grid.height()});
Expand Down
3 changes: 1 addition & 2 deletions vpr/src/route/route_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,11 @@ static vtr::vector<ParentBlockId, std::vector<RRNodeId>> load_rr_clb_sources(con

static vtr::vector<ParentNetId, uint8_t> load_is_clock_net(const Netlist<>& net_list,
bool is_flat) {
vtr::vector<ParentNetId, uint8_t> is_clock_net;
vtr::vector<ParentNetId, uint8_t> is_clock_net(net_list.nets().size());

auto& atom_ctx = g_vpr_ctx.atom();
std::set<AtomNetId> clock_nets = find_netlist_physical_clock_nets(atom_ctx.nlist);

is_clock_net.resize(net_list.nets().size());
for (auto net_id : net_list.nets()) {
std::size_t net_id_num = std::size_t(net_id);
if (is_flat) {
Expand Down
4 changes: 1 addition & 3 deletions vpr/src/route/router_lookahead_map_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1219,9 +1219,7 @@ static void run_intra_tile_dijkstra(const RRGraphView& rr_graph,
node_expanded.resize(rr_graph.num_nodes());
std::fill(node_expanded.begin(), node_expanded.end(), false);

vtr::vector<RRNodeId, float> node_seen_cost;
node_seen_cost.resize(rr_graph.num_nodes());
std::fill(node_seen_cost.begin(), node_seen_cost.end(), -1.);
vtr::vector<RRNodeId, float> node_seen_cost(rr_graph.num_nodes(), -1.f);

struct t_pq_entry {
float delay;
Expand Down

0 comments on commit e8eeed3

Please sign in to comment.