https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105679
Bug ID: 105679 Summary: erroneous -Warray-bounds warning with sanitizer Product: gcc Version: 12.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- Created attachment 53010 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53010&action=edit test case minimized as much as possible Some combination of things (likely triggered by -fsanitize=shift and an array index being used with "<<" operator) is causing erroneous warnings about array bounds accesses: $ gcc -O2 -Warray-bounds -fno-strict-aliasing -fno-strict-overflow -fsanitize=shift -fsanitize-coverage=trace-pc -c -o /dev/null test.c test.c: In function 'work.isra': test.c:31:32: warning: array subscript 32 is above array bounds of 'struct object[2]' [-Warray-bounds] 31 | entry = instance->array[irq]; | ~~~~~~~~~~~~~~~^~~~~ test.c:19:23: note: while referencing 'array' 19 | struct object array[ELEMENTS]; | ^~~~~