From ea28a92dc7fef546959c83a665ea7f6bb0dadec6 Mon Sep 17 00:00:00 2001 From: tg-at-google Date: Wed, 27 May 2020 21:47:38 -0400 Subject: [PATCH 1/4] in resolution of [Wsign-compare] warning id 0 I looked a little into the context of how the variables 'last_node' and 'graph_info_->num_nodes()' are used. num_nodes() implies that the quantity returned is unsigned/non-negative, although the same assumption cannot be clearly made about last_node. I cast last_node to size_t under the assumption that it is being utilized as a size/non-negative quantity. --- tensorflow/lite/arena_planner.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/lite/arena_planner.cc b/tensorflow/lite/arena_planner.cc index d97eca46929..5dfc4351f54 100644 --- a/tensorflow/lite/arena_planner.cc +++ b/tensorflow/lite/arena_planner.cc @@ -197,7 +197,7 @@ TfLiteStatus ArenaPlanner::ExecuteAllocations(int first_node, int last_node) { dealloc_node_.resize(graph_info_->num_tensors(), kNodeNotAssigned); allocs_.resize(graph_info_->num_tensors()); // Set allocation and deallocation for temporary tensors. - for (size_t i = first_node; i <= last_node && i < graph_info_->num_nodes(); + for (size_t i = first_node; i <= (size_t)last_node && i < (size_t)(graph_info_->num_nodes()); ++i) { const TfLiteNode& node = graph_info_->node(i); TfLiteIntArray* node_temporaries = node.temporaries; From b7d2ccf30fba247bf6c469fe7bf792c458c99790 Mon Sep 17 00:00:00 2001 From: tg-at-google Date: Mon, 1 Jun 2020 09:06:02 -0400 Subject: [PATCH 2/4] in resolution of [Wsign-compare] warning id 1 #c2 --- tensorflow/lite/arena_planner.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/lite/arena_planner.cc b/tensorflow/lite/arena_planner.cc index 5dfc4351f54..6359cac47f3 100644 --- a/tensorflow/lite/arena_planner.cc +++ b/tensorflow/lite/arena_planner.cc @@ -197,7 +197,7 @@ TfLiteStatus ArenaPlanner::ExecuteAllocations(int first_node, int last_node) { dealloc_node_.resize(graph_info_->num_tensors(), kNodeNotAssigned); allocs_.resize(graph_info_->num_tensors()); // Set allocation and deallocation for temporary tensors. - for (size_t i = first_node; i <= (size_t)last_node && i < (size_t)(graph_info_->num_nodes()); + for (size_t i = first_node; i <= (size_t)last_node && i < graph_info_->num_nodes(); ++i) { const TfLiteNode& node = graph_info_->node(i); TfLiteIntArray* node_temporaries = node.temporaries; From 17a2158596e9f250d2789dd9dbc8be317d65c49e Mon Sep 17 00:00:00 2001 From: tg-at-google Date: Mon, 1 Jun 2020 09:06:12 -0400 Subject: [PATCH 3/4] in resolution of [Wsign-compare] warning id 1 #c2 From 85dcf96a8a2720ba9cd0038020a61a3ca68cc8d0 Mon Sep 17 00:00:00 2001 From: tg-at-google Date: Mon, 1 Jun 2020 20:04:52 +0000 Subject: [PATCH 4/4] in resolution of [Wsign-compare] warning id 1 #c3 Co-authored-by: Mihai Maruseac --- tensorflow/lite/arena_planner.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/lite/arena_planner.cc b/tensorflow/lite/arena_planner.cc index 6359cac47f3..a614d115dcf 100644 --- a/tensorflow/lite/arena_planner.cc +++ b/tensorflow/lite/arena_planner.cc @@ -197,7 +197,7 @@ TfLiteStatus ArenaPlanner::ExecuteAllocations(int first_node, int last_node) { dealloc_node_.resize(graph_info_->num_tensors(), kNodeNotAssigned); allocs_.resize(graph_info_->num_tensors()); // Set allocation and deallocation for temporary tensors. - for (size_t i = first_node; i <= (size_t)last_node && i < graph_info_->num_nodes(); + for (size_t i = first_node; i <= static_cast(last_node) && i < graph_info_->num_nodes(); ++i) { const TfLiteNode& node = graph_info_->node(i); TfLiteIntArray* node_temporaries = node.temporaries;