Skip to content

Commit 938677a

Browse files
committed
vega_sdk_riscv: Ignore GCC warning about potential uninitialized variable
When -ffreestanding is not enabled, and GCC is able to use it's knowledge of memset semantics, it sometimes gets it wrong, as in this case. I'm not quite sure what is confusing it here, but the code sure looks correct. Signed-off-by: Keith Packard <[email protected]>
1 parent 40d049f commit 938677a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

vega_sdk_riscv/devices/RV32M1/drivers/fsl_cau3_ble.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4077,6 +4077,11 @@ status_t CAU3_CHACHA20_POLY1305_SetKey(CAU3_Type *base, cau3_handle_t *handle, c
40774077

40784078
static status_t cau3_load_nonce(CAU3_Type *base, const uint8_t *nonce, cau3_key_slot_t keySlot)
40794079
{
4080+
#if defined(__GNUC__)
4081+
#pragma GCC diagnostic push
4082+
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
4083+
#endif
4084+
40804085
union {
40814086
uint8_t b[16];
40824087
uint32_t w[4];
@@ -4092,6 +4097,9 @@ static status_t cau3_load_nonce(CAU3_Type *base, const uint8_t *nonce, cau3_key_
40924097
tempIv.w[2] = __REV(tempIv.w[2]);
40934098

40944099
return CAU3_LoadKeyInitVector(base, tempIv.b, keySlot, kCAU3_TaskDonePoll);
4100+
#if defined(__GNUC__)
4101+
#pragma GCC diagnostic pop
4102+
#endif
40954103
}
40964104

40974105
status_t CAU3_CHACHA20_POLY1305_Encrypt(CAU3_Type *base,

0 commit comments

Comments
 (0)