From b8d245499ef9bca5e6f6ac39f48adebb2c989b36 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 23 Jan 2026 17:38:39 -0600 Subject: [PATCH] testsuites/sptests/spcache01/init.c: Address -Wclobbered warning This warning indicates the potential for using a local variable which is not guaranteed to be preserved across a setjmp()/longjmp() pair. Updates #5364. --- testsuites/sptests/spcache01/init.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/testsuites/sptests/spcache01/init.c b/testsuites/sptests/spcache01/init.c index c37cab1273..64d42a0b73 100644 --- a/testsuites/sptests/spcache01/init.c +++ b/testsuites/sptests/spcache01/init.c @@ -185,6 +185,15 @@ static uint64_t store(void) return rtems_counter_ticks_to_nanoseconds(d); } +static bool cache_invalidate_wrapper(void) +{ + if (setjmp(instruction_invalidate_return_context) == 0) { + rtems_cache_invalidate_multiple_instruction_lines(do_some_work, 4096); + return false; + } + return true; +} + static void test_timing(void) { RTEMS_INTERRUPT_LOCK_DECLARE(, lock) @@ -381,12 +390,7 @@ static void test_timing(void) do_longjmp = true; - if (setjmp(instruction_invalidate_return_context) == 0) { - rtems_cache_invalidate_multiple_instruction_lines(do_some_work, 4096); - exception = false; - } else { - exception = true; - } + exception = cache_invalidate_wrapper(); do_longjmp = false;