From a2fc64311b96c199f629344e88ad657cf3b40430 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 15 Dec 2025 11:18:22 +0100 Subject: [PATCH] fix warning for array subscript -2 is below array bounds of Idx2Freq_Tbl[] --- lib_com/cnst.h | 4 ++++ lib_com/options.h | 1 + 2 files changed, 5 insertions(+) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 7f435eaa9..036602ddc 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -2731,7 +2731,11 @@ extern const Word16 Idx2Freq_Tbl[]; /* 'x' is converted to Q6, 'Freq_Tbl'/1000 in Q9 */ /* only works for 'fs' = [8000,12800,16000,25600,32000,48000] (unpredictable otherwise) */ /* 15625 is 1000000.0f/Q6 but we use the calculated value to avoid float point code */ +#ifdef FIX_2286_GCC_WARNING_Idx2Freq_Tbl +#define NS2SA_FX2(fs,x) (chk_fs(fs) mult(Idx2Freq_Tbl[L_and(L_shr(fs,8),7)-2], (Word16)((x)/15625))) +#else #define NS2SA_FX2(fs,x) (chk_fs(fs) mult((&Idx2Freq_Tbl[-2])[L_and(L_shr(fs,8),7)], (Word16)((x)/15625))) +#endif #define L_FRAME_12k8 256 /* Frame size at 12k8Hz: 20ms = 256 samples */ #define L_FRAME_16k 320 /* Frame size at 16kHz: 20ms = 320 samples */ diff --git a/lib_com/options.h b/lib_com/options.h index ee8c6be3a..7c311782c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -89,6 +89,7 @@ #define FIX_2252_SCALING_SAVE_HB_SYNTH /* VA: issue 2252: fix use-of-uninit-value in save_hb_synth_fx[] scaling in FOA decoding with bitstream that starts with an SID */ #define FIX_2248_EVS_ASSERT /* VA: Include _sat in an EVS related part of the code */ #define FIX_2254_IMPROV_COMPLEXITY_BE /* VA: BE small complexity reduction */ +#define FIX_2286_GCC_WARNING_Idx2Freq_Tbl /* FhG: Fix compiler warning for OOB access of Idx2Freq_Tbl[] */ /* #################### End BE switches ################################## */ -- GitLab