From 553e241a4032e8fbd7cdd27ad1df47831cb74dde Mon Sep 17 00:00:00 2001 From: Pablo Marquez Tello Date: Thu, 4 Apr 2024 16:35:28 +0100 Subject: 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 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/11381 Reviewed-by: Gunes Bayir Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Benchmark: Arm Jenkins --- src/core/utils/helpers/tensor_transform.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/core') 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; } -- cgit v1.2.1