From e16593ebc063ecdfdf89acc846c20bb5d2a459e1 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Thu, 2 Jul 2026 07:55:14 +0530 Subject: [PATCH] fix(esp_psram): fix unused-but-set-variable warning with GCC 16 GCC 16 flags the volatile accumulator in the cache writeback loops even though it is volatile, as it is only used to update itself. Drop the accumulator and rely on the volatile-qualified psram pointer to keep the cache-line reads from being optimized out. --- components/esp_psram/esp32/esp_psram_extram_cache.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/esp_psram/esp32/esp_psram_extram_cache.c b/components/esp_psram/esp32/esp_psram_extram_cache.c index 1ee185e1ed2..7cfc1047376 100644 --- a/components/esp_psram/esp32/esp_psram_extram_cache.c +++ b/components/esp_psram/esp32/esp_psram_extram_cache.c @@ -24,7 +24,6 @@ void IRAM_ATTR esp_psram_extram_writeback_cache(void) { int x; - volatile int i = 0; volatile uint8_t *psram = (volatile uint8_t*)SOC_EXTRAM_DATA_LOW; int cache_was_disabled = 0; @@ -51,7 +50,7 @@ void IRAM_ATTR esp_psram_extram_writeback_cache(void) the cache by just reading 64K worth of cache lines. */ for (x = 0; x < 1024 * 64; x += 32) { - i += psram[x]; + (void)psram[x]; } #else /* @@ -61,8 +60,8 @@ void IRAM_ATTR esp_psram_extram_writeback_cache(void) we ever support external RAM chips of 2M or smaller, this may need adjusting. */ for (x = 0; x < 1024 * 64; x += 32) { - i += psram[x]; - i += psram[x + (1024 * 1024 * 2)]; + (void)psram[x]; + (void)psram[x + (1024 * 1024 * 2)]; } #endif