warning: array subscript 'uint32_t {aka unsigned int}[0]' is partly outside array bounds of 'uint8_t[1]' {aka 'unsigned char[1]'}I

I added the following function to convert an uint8_t array to uint32_t. But west build with warning: array subscript 'uint32_t {aka unsigned int}[0]' is partly outside array bounds of 'uint8_t[1]' {aka 'unsigned char[1]'} [-Warray-bounds]
574 | *regVal = spiData2Uint32(rxBufU8);

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
uint32_t spiData2Uint32(const uint8_t* pData) {
uint32_t data32[4];
for (int i=0; i<4; i++) {
data32[i] = *(pData + i);
}
const uint32_t ui = data32[3] << 16 |
data32[2] << 8 |
data32[1];
return ui;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
C:\ncs\v2.4.0\nrf\samples\minimal_log_adc>west build -b custom_nrf5340_cpuapp
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/ncs/v2.4.0/nrf/samples/minimal_log_adc
-- CMake version: 3.20.5
-- Using NCS Toolchain 2.4.0 for building. (C:/ncs/toolchains/31f4403e35/cmake)
-- Found Python3: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
-- Cache files will be written to: C:/ncs/v2.4.0/zephyr/.cache
-- Zephyr version: 3.3.99 (C:/ncs/v2.4.0/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
-- Board: custom_nrf5340_cpuapp
-- Found host-tools: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/31f4403e35/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found BOARD.dts: C:/ncs/v2.4.0/nrf/boards/arm/custom_nrf5340/custom_nrf5340_cpuapp.dts
-- Found devicetree overlay: C:/ncs/v2.4.0/nrf/samples/minimal_log_adc/custom_nrf5340_cpuapp.overlay
-- Generated zephyr.dts: C:/ncs/v2.4.0/nrf/samples/minimal_log_adc/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/ncs/v2.4.0/nrf/samples/minimal_log_adc/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/ncs/v2.4.0/nrf/samples/minimal_log_adc/build/zephyr/dts.cmake
Parsing C:/ncs/v2.4.0/zephyr/Kconfig
Loaded configuration 'C:/ncs/v2.4.0/nrf/boards/arm/custom_nrf5340/custom_nrf5340_cpuapp_defconfig'
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX