From bf926e3546530aea5fbb54e85121ddaabd66d8f9 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Thu, 19 Oct 2017 17:21:21 +0200
Subject: [PATCH] bugfix/warning removal

The warning was:

/roux/ru/openairinterface5g/openair1/PHY/LTE_TRANSPORT/pucch.c: In function 'generate_pucch2x':
/roux/ru/openairinterface5g/openair1/PHY/LTE_TRANSPORT/pucch.c:729:73: warning: array subscript is above array bounds [-Warray-bounds]
       AssertFatal(1==0,"Illegal modulation symbol %d for PUCCH %s\n",B2,pucch_format_string[fmt]);
                                                                         ^
/roux/ru/openairinterface5g/common/utils/./itti/assertions.h:52:53: note: in definition of macro '_Assert_'
                 __FUNCTION__, __FILE__, __LINE__, ##aRGS);  \
                                                     ^~~~
/roux/ru/openairinterface5g/openair1/PHY/LTE_TRANSPORT/pucch.c:729:7: note: in expansion of macro 'AssertFatal'
       AssertFatal(1==0,"Illegal modulation symbol %d for PUCCH %s\n",B2,pucch_format_string[fmt]);
       ^
The root cause was that the array pucch_format_string was not in sync with
the structure. (This plus why force its size and put \0 in the string...)
---
 openair1/PHY/LTE_TRANSPORT/pucch.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c
index ad9ed2c95d8..05355c9992a 100644
--- a/openair1/PHY/LTE_TRANSPORT/pucch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pucch.c
@@ -113,7 +113,18 @@ int16_t W3_im[3][6] = {{0    ,0     ,0     },
   {0    ,-28378, 28377}
 };
 
-char pucch_format_string[6][20] = {"format 1\0","format 1a\0","format 1b\0","format 2\0","format 2a\0","format 2b\0"};
+char *pucch_format_string[] = {
+  "format 1",
+  "format 1a",
+  "format 1b",
+  "pucch_format1b_csA2",
+  "pucch_format1b_csA3",
+  "pucch_format1b_csA4",
+  "format 2",
+  "format 2a",
+  "format 2b",
+  "pucch_format3"
+};
 
 /* PUCCH format3 >> */
 #define D_I             0
-- 
GitLab