From 2eff037080996e67a79e381667f0b77252e653b8 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty <91244425+sudeep-mohanty@users.noreply.github.com> Date: Wed, 22 Jun 2022 06:33:44 +0200 Subject: [PATCH] Update prvYieldCore() compile warning for single core targets (#505) When configNUM_CORES is 1, prvYieldCore() generates an array subscript outofbound error (-Warray-bounds) when compiled with GCC with space optimization enabled (-Os). This commit updates the code flow in prvYieldCore() to compile out the part where yield is needed on the other core which is unnecessary for single-core targets. --- tasks.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tasks.c b/tasks.c index 7eb1409aa..046aed9aa 100644 --- a/tasks.c +++ b/tasks.c @@ -703,11 +703,13 @@ static void prvYieldCore( BaseType_t xCoreID ) { xYieldPendings[ xCoreID ] = pdTRUE; } - else - { - portYIELD_CORE( xCoreID ); - pxCurrentTCBs[ xCoreID ]->xTaskRunState = taskTASK_YIELDING; - } + #if ( configNUM_CORES > 1 ) + else + { + portYIELD_CORE( xCoreID ); + pxCurrentTCBs[ xCoreID ]->xTaskRunState = taskTASK_YIELDING; + } + #endif } }