1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/cc26xx_cc13xx
Marian Buschsieweke d6499fa8fd
cpu/cc26xx_cc13xx: Fix bogus array-bound warning
GCC 12 create a bogus array out of bounds warning as it assumes that
because there is special handling for `uart == 0` and `uart == 1`,
`uart` can indeed be `1`. There is an `assert(uart < UART_NUMOF)` above
that would blow up prior to any out of bounds access.

In any case, optimizing out the special handling of `uart == 1` for
when `UART_NUMOF == 1` likely improves the generated code and fixes
the warning.

    /home/maribu/Repos/software/RIOT/cc2650/cpu/cc26xx_cc13xx/periph/uart.c:88:8: error: array subscript 1 is above array bounds of 'uart_isr_ctx_t[1]' [-Werror=array-bounds]
       88 |     ctx[uart].rx_cb = rx_cb;
          |     ~~~^~~~~~
    /home/maribu/Repos/software/RIOT/cc2650/cpu/cc26xx_cc13xx/periph/uart.c:52:23: note: while referencing 'ctx'
       52 | static uart_isr_ctx_t ctx[UART_NUMOF];
          |                       ^~~
    /home/maribu/Repos/software/RIOT/cc2650/cpu/cc26xx_cc13xx/periph/uart.c:89:8: error: array subscript 1 is above array bounds of 'uart_isr_ctx_t[1]' [-Werror=array-bounds]
       89 |     ctx[uart].arg = arg;
          |     ~~~^~~~~~
    /home/maribu/Repos/software/RIOT/cc2650/cpu/cc26xx_cc13xx/periph/uart.c:52:23: note: while referencing 'ctx'
       52 | static uart_isr_ctx_t ctx[UART_NUMOF];
          |                       ^~~
2023-04-25 15:31:27 +02:00
..
include cpu/cc26xx_cc13xx: fix doxygen grouping warnings 2021-09-11 12:45:15 +02:00
ldscripts cpu/cc26xx_cc13xx: use _rom_length symbol for CCFG origin 2020-09-30 11:52:04 -05:00
periph cpu/cc26xx_cc13xx: Fix bogus array-bound warning 2023-04-25 15:31:27 +02:00
doc.txt boards/common/cc26xx_cc13xx: Fix flashing with upstream OpenOCD 2023-01-10 22:39:35 +01:00
Kconfig cpu/cc26xx_cc13xx: model Kconfig 2021-11-19 10:50:50 +01:00
Makefile cpu/cc26x0: Factor out code common for cc26xx/cc13xx family 2019-10-29 21:27:00 +01:00
Makefile.dep cpu/cortexm_common: Move common modules to Makefile.dep 2020-04-01 09:46:21 +02:00
Makefile.features cpu/cc26x0: Factor out code common for cc26xx/cc13xx family 2019-10-29 21:27:00 +01:00
Makefile.include cpu/cc26xx_cc13xx: add & link CCFG configuration 2020-09-27 17:58:11 -05:00
power_arch.c cpu/cc26xx_cc13xx: enable periph clocks on sleep 2020-10-01 18:38:03 -05:00
vectors.c cpu/cc26xx_cc13xx: fix typo on XOSC selection 2020-10-12 14:37:55 -05:00