https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109233
Bug ID: 109233
Summary: warning: array subscript 5 is above array bounds of
‘struct tg3_napi[5]’
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: ubizjak at gmail dot com
Target Milestone: ---
There is another bogus array bounds warning when compiling linux in:
drivers/net/ethernet/broadcom/tg3.c: In function ‘tg3_init_one’:
drivers/net/ethernet/broadcom/tg3.c:17787:51: error: array subscript 5 is above
array bounds of ‘struct tg3_napi[5]’ [-Werror=array-bounds=]
17787 | struct tg3_napi *tnapi = &tp->napi[i];
| ~~~~~~~~^~~
In file included from drivers/net/ethernet/broadcom/tg3.c:72:
drivers/net/ethernet/broadcom/tg3.h:3203:41: note: while referencing ‘napi’
3203 | struct tg3_napi napi[TG3_IRQ_MAX_VECS];
| ^~~~
drivers/net/ethernet/broadcom/tg3.c:17787:51: error: array subscript 5 is above
array bounds of ‘struct tg3_napi[5]’ [-Werror=array-bounds=]
17787 | struct tg3_napi *tnapi = &tp->napi[i];
| ~~~~~~~~^~~
drivers/net/ethernet/broadcom/tg3.h:3203:41: note: while referencing ‘napi’
3203 | struct tg3_napi napi[TG3_IRQ_MAX_VECS];
| ^~~~
cc1: all warnings being treated as errors