From 00bef3226d530b7943cdd050874fc7b0f7ea227f Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 13 Aug 2025 01:52:10 +0200 Subject: [PATCH] bsps/irq: Fix array bounds warning Use a one element array to prevent array subscript index is outside array bounds warnings. Close #5298. --- bsps/include/bsp/irq-generic.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bsps/include/bsp/irq-generic.h b/bsps/include/bsp/irq-generic.h index eeea2e3df2..279a0d3575 100644 --- a/bsps/include/bsp/irq-generic.h +++ b/bsps/include/bsp/irq-generic.h @@ -68,7 +68,12 @@ extern "C" { #endif #ifndef BSP_INTERRUPT_DISPATCH_TABLE_SIZE - #define BSP_INTERRUPT_DISPATCH_TABLE_SIZE BSP_INTERRUPT_VECTOR_COUNT + #if BSP_INTERRUPT_VECTOR_COUNT == 0 + /* Avoid array subscript index is outside array bounds warnings */ + #define BSP_INTERRUPT_DISPATCH_TABLE_SIZE 1 + #else + #define BSP_INTERRUPT_DISPATCH_TABLE_SIZE BSP_INTERRUPT_VECTOR_COUNT + #endif #endif #if !defined(BSP_IRQ_HAVE_GET_SET_AFFINITY) && defined(RTEMS_SMP)