[Bug tree-optimization/108306] false-positive -Warray-bounds warning emitted with -fsanitize=shift
kees at outflux dot net
gcc-bugzilla@gcc.gnu.org
Sat Jan 14 00:16:38 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108306
--- Comment #7 from Kees Cook <kees at outflux dot net> ---
(In reply to Kees Cook from comment #6)
> Sorry, I forgot to include those details fully! Here's how I'm seeing it:
>
> $ gcc --version
> gcc (GCC) 13.0.0 20230105 (experimental)
> ...
> $ gcc -O2 -fno-strict-overflow -fsanitize=shift -Warray-bounds -c -o
> /dev/null poc.c
In function 'psi_group_change',
inlined from 'psi_task_switch' at poc.c:25:2:
poc.c:15:30: warning: array subscript 32 is above array bounds of 'unsigned
int[4]' [-Warray-bounds=]
15 | tasks[t]++;
| ~~~~~^~~
poc.c: In function 'psi_task_switch':
poc.c:6:14: note: while referencing 'tasks'
6 | unsigned int tasks[NR_PSI_TASK_COUNTS];
| ^~~~~
(mispaste)
More information about the Gcc-bugs
mailing list