Skip to content

Commit 27604e0

Browse files
committed
Invalid zeroth element for 1-based array
1 parent aff8f1a commit 27604e0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

vpr/src/route/route_timing.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,10 +893,15 @@ 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. First element is empty.*/
896+
*pin_criticality_ptr = new float[max_sinks + 1]; /* First sink is pin #1.*/
897897
*sink_order_ptr = new int[max_sinks + 1];
898898
*rt_node_of_sink_ptr = new t_rt_node*[max_sinks + 1];
899899

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;
904+
900905
alloc_route_tree_timing_structs();
901906
}
902907

0 commit comments

Comments
 (0)