[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:15:32 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108306
--- Comment #6 from Kees Cook <kees at outflux dot net> ---
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
enum psi_task_count {
NR_IOWAIT,
NR_PSI_TASK_COUNTS = 4,
};
unsigned int tasks[NR_PSI_TASK_COUNTS];
static void psi_group_change(unsigned int set)
{
unsigned int t;
unsigned int state_mask = 0;
for (t = 0; set; set &= ~(1 << t), t++)
if (set & (1 << t))
tasks[t]++;
}
void psi_task_switch(int sleep)
{
int set = 0;
if (sleep)
set |= (1 << NR_IOWAIT);
psi_group_change(set);
}
More information about the Gcc-bugs
mailing list