aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Marquez Tello <pablo.tello@arm.com>2024-04-04 16:35:28 +0100
committerPablo Marquez Tello <pablo.tello@arm.com>2024-04-05 11:00:56 +0000
commit553e241a4032e8fbd7cdd27ad1df47831cb74dde (patch)
tree2f6dfb85c94bdb0c2d1e694182005188371bdbf0
parent1e91d71aaadd2154a708de1bc95f3c937b1e718a (diff)
downloadComputeLibrary-553e241a4032e8fbd7cdd27ad1df47831cb74dde.tar.gz
Fix compiler error
* This fixes the GCC 12 compiler error: Assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow] * Resolves ARMCL-1130 Change-Id: I01e10ebca2dbfcd166c1f4128921953e31016038 Signed-off-by: Pablo Marquez Tello <pablo.tello@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/11381 Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--src/core/utils/helpers/tensor_transform.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/utils/helpers/tensor_transform.cpp b/src/core/utils/helpers/tensor_transform.cpp
index 19d0badd74..212cfdabaa 100644
--- a/src/core/utils/helpers/tensor_transform.cpp
+++ b/src/core/utils/helpers/tensor_transform.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 Arm Limited.
+ * Copyright (c) 2018-2020, 2024 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -117,7 +117,10 @@ int calculate_end_on_index(TensorShape input_shape,
}
// Final clamp
- stop = (stride > 0) ? utility::clamp(stop, 0, dim_size) : utility::clamp(stop, -1, dim_size - 1);
+ if (stride > 0)
+ stop = utility::clamp(stop, 0, dim_size);
+ else
+ stop = utility::clamp(stop, -1, dim_size - 1);
return stop;
}