Skip to content

Commit 119560c

Browse files
authored
Merge pull request #2114 from verilog-to-routing/route_timing_offset
Addressing route_timing Offset
2 parents 8e4d8ea + 949dce0 commit 119560c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

vpr/src/route/route_timing.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -893,9 +893,14 @@ void alloc_timing_driven_route_structs(float** pin_criticality_ptr,
893893

894894
int max_sinks = std::max(get_max_pins_per_net() - 1, 0);
895895

896-
*pin_criticality_ptr = new float[max_sinks] - 1; /* First sink is pin #1. */
897-
*sink_order_ptr = new int[max_sinks] - 1;
898-
*rt_node_of_sink_ptr = new t_rt_node*[max_sinks] - 1;
896+
*pin_criticality_ptr = new float[max_sinks + 1]; /* First sink is pin #1.*/
897+
*sink_order_ptr = new int[max_sinks + 1];
898+
*rt_node_of_sink_ptr = new t_rt_node*[max_sinks + 1];
899+
900+
/* Element 0 should be an invalid value so we are likely to crash if we accidentally use it. */
901+
(*pin_criticality_ptr)[0] = -1;
902+
(*sink_order_ptr)[0] = -1;
903+
(*rt_node_of_sink_ptr)[0] = nullptr;
899904

900905
alloc_route_tree_timing_structs();
901906
}
@@ -908,11 +913,11 @@ void free_timing_driven_route_structs(float* pin_criticality, int* sink_order, t
908913
/* Frees all the structures needed only by the timing-driven router. */
909914

910915
// coverity[offset_free : Intentional]
911-
delete[](pin_criticality + 1); /* Starts at index 1. */
916+
delete[](pin_criticality);
912917
// coverity[offset_free : Intentional]
913-
delete[](sink_order + 1);
918+
delete[](sink_order);
914919
// coverity[offset_free : Intentional]
915-
delete[](rt_node_of_sink + 1);
920+
delete[](rt_node_of_sink);
916921

917922
free_route_tree_timing_structs();
918923
}

0 commit comments

Comments
 (0)