From c8c158e065370f8700e09c83db3a3f06f21f1bb5 Mon Sep 17 00:00:00 2001 From: laurent Date: Mon, 21 Nov 2022 09:46:42 +0100 Subject: [PATCH] gcc ubsan detected warnings --- .../PHY/LTE_ESTIMATION/lte_eNB_measurements.c | 2 +- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 62 +++++++++---------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c index 7eeeb998ba..9393bfc048 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c @@ -107,7 +107,7 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB, n0_power_tot=0; int offset0= (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size; - if ((rb_mask[rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe + if ((rb_mask[rb>>5]&(1U<<(rb&31))) == 0) { // check that rb was not used in this subframe nb_rb++; for (aarx=0; aarxnb_antennas_rx; aarx++) { measurements->n0_subband_power[aarx][rb] = 0; diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index d2c45d0561..4b1cf2cbee 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -725,16 +725,16 @@ int allocate_REs_in_RB_no_pilots_QPSK_tm2(PHY_VARS_eNB* phy_vars_eNB, (((uint32_t)x0p[2])<<2)| (((uint32_t)x0p[3])<<3); - txF0[0]=qam_table4_0[qam4_table_offset]; - txF1[0]=qam_table4_1[qam4_table_offset]; + memcpy(txF0, &qam_table4_0[qam4_table_offset], sizeof(*txF0)); + memcpy(txF1, &qam_table4_1[qam4_table_offset], sizeof(*txF1)); x0p+=4; qam4_table_offset=(((uint32_t)x0p[0]))| - (((uint32_t)x0p[1])<<1)| - (((uint32_t)x0p[2])<<2)| - (((uint32_t)x0p[3])<<3); - txF0[1]=qam_table4_0[qam4_table_offset]; - txF1[1]=qam_table4_1[qam4_table_offset]; + (((uint32_t)x0p[1])<<1)| + (((uint32_t)x0p[2])<<2)| + (((uint32_t)x0p[3])<<3); + memcpy(txF0+1, &qam_table4_0[qam4_table_offset], sizeof(*txF0)); + memcpy(txF1+1, &qam_table4_1[qam4_table_offset], sizeof(*txF1)); x0p+=4; qam4_table_offset=(((uint32_t)x0p[0]))| @@ -742,8 +742,8 @@ int allocate_REs_in_RB_no_pilots_QPSK_tm2(PHY_VARS_eNB* phy_vars_eNB, (((uint32_t)x0p[2])<<2)| (((uint32_t)x0p[3])<<3); - txF0[2]=qam_table4_0[qam4_table_offset]; - txF1[2]=qam_table4_1[qam4_table_offset]; + memcpy(txF0+2, &qam_table4_0[qam4_table_offset], sizeof(*txF0)); + memcpy(txF1+2, &qam_table4_1[qam4_table_offset], sizeof(*txF1)); if(skip_half==0) { if (skip_dc>0) { @@ -757,23 +757,23 @@ int allocate_REs_in_RB_no_pilots_QPSK_tm2(PHY_VARS_eNB* phy_vars_eNB, (((uint32_t)x0p[2])<<2)| (((uint32_t)x0p[3])<<3); - txF0[3]=qam_table4_0[qam4_table_offset]; - txF1[3]=qam_table4_1[qam4_table_offset]; + memcpy(txF0+3, &qam_table4_0[qam4_table_offset], sizeof(*txF0)); + memcpy(txF1+3, &qam_table4_1[qam4_table_offset], sizeof(*txF1)); x0p+=4; qam4_table_offset=(((uint32_t)x0p[0]))| - (((uint32_t)x0p[1])<<1)| - (((uint32_t)x0p[2])<<2)| - (((uint32_t)x0p[3])<<3); - - txF0[4]=qam_table4_0[qam4_table_offset]; - txF1[4]=qam_table4_1[qam4_table_offset]; + (((uint32_t)x0p[1])<<1)| + (((uint32_t)x0p[2])<<2)| + (((uint32_t)x0p[3])<<3); + + memcpy(txF0+4, &qam_table4_0[qam4_table_offset], sizeof(*txF0)); + memcpy(txF1+4, &qam_table4_1[qam4_table_offset], sizeof(*txF1)); x0p+=4; qam4_table_offset=(((uint32_t)x0p[0]))| (((uint32_t)x0p[1])<<1)| (((uint32_t)x0p[2])<<2)| (((uint32_t)x0p[3])<<3); - txF0[5]=qam_table4_0[qam4_table_offset]; - txF1[5]=qam_table4_1[qam4_table_offset]; + memcpy(txF0+5, &qam_table4_0[qam4_table_offset], sizeof(*txF0)); + memcpy(txF1+5, &qam_table4_1[qam4_table_offset], sizeof(*txF1)); } if(skip_half!=0) { @@ -3025,20 +3025,20 @@ inline int check_skip_dc(int rb,LTE_DL_FRAME_PARMS *frame_parms) { } -uint64_t qam4_tm2_p2_0[8][16]; -uint64_t qam4_tm2_p2_1[8][16]; -uint64_t qam4_tm2_p2_b0[8][4][16]; -uint64_t qam4_tm2_p2_b1[8][4][16]; +uint64_t qam4_tm2_p2_0[8][16] __attribute__ ((aligned(32))); +uint64_t qam4_tm2_p2_1[8][16] __attribute__ ((aligned(32))); +uint64_t qam4_tm2_p2_b0[8][4][16] __attribute__ ((aligned(32))); +uint64_t qam4_tm2_p2_b1[8][4][16] __attribute__ ((aligned(32))); -uint64_t qam16_tm2_p2_0[8][256]; -uint64_t qam16_tm2_p2_1[8][256]; -uint64_t qam16_tm2_p2_b0[8][4][256]; -uint64_t qam16_tm2_p2_b1[8][4][256]; +uint64_t qam16_tm2_p2_0[8][256] __attribute__ ((aligned(32))); +uint64_t qam16_tm2_p2_1[8][256] __attribute__ ((aligned(32))); +uint64_t qam16_tm2_p2_b0[8][4][256] __attribute__ ((aligned(32))); +uint64_t qam16_tm2_p2_b1[8][4][256] __attribute__ ((aligned(32))); -uint64_t qam64_tm2_p2_0[8][4096]; -uint64_t qam64_tm2_p2_1[8][4096]; -uint64_t qam64_tm2_p2_b0[8][4][4096]; -uint64_t qam64_tm2_p2_b1[8][4][4096]; +uint64_t qam64_tm2_p2_0[8][4096] __attribute__ ((aligned(32))); +uint64_t qam64_tm2_p2_1[8][4096] __attribute__ ((aligned(32))); +uint64_t qam64_tm2_p2_b0[8][4][4096] __attribute__ ((aligned(32))); +uint64_t qam64_tm2_p2_b1[8][4][4096] __attribute__ ((aligned(32))); void init_modulation_LUT_qam4_tm2_p2() {