https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102706
Bug ID: 102706 Summary: [12 regression] -O2 vectorization causes regression in Warray-bounds-48.c on many targets Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: law at gcc dot gnu.org Target Milestone: --- More fallout from enabling auto-vectorization at -O2. gcc.dg/Warray-bonds-48.c is regressing on most (but not all) of the embedded targets. Just picking one semi-randomly, iq2000-elf: Running target iq2000-sim Using /usr/share/dejagnu/baseboards/iq2000-sim.exp as board description file for target. Using /usr/share/dejagnu/config/sim.exp as generic interface file for target. Using /usr/share/dejagnu/baseboards/basic-sim.exp as board description file for target. Using /home/jlaw/jenkins/workspace/iq2000-elf/gcc/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /home/jlaw/jenkins/workspace/iq2000-elf/gcc/gcc/testsuite/gcc.dg/dg.exp ... FAIL: gcc.dg/Warray-bounds-48.c (test for excess errors) === gcc Summary === # of expected passes 38 # of unexpected failures 1 /home/jlaw/jenkins/workspace/iq2000-elf/iq2000-elf-obj/gcc/gcc/xgcc version 12.0.0 20211008 (experimental) (GCC) >From the log file we see: FAIL: gcc.dg/Warray-bounds-48.c (test for excess errors) Excess errors: /home/jlaw/jenkins/workspace/iq2000-elf/gcc/gcc/testsuite/gcc.dg/Warray-bounds-48.c:33:12: warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=] /home/jlaw/jenkins/workspace/iq2000-elf/gcc/gcc/testsuite/gcc.dg/Warray-bounds-48.c:133:12: warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=] My very cursory examination of the test tells me this is a bogus warning. In both cases we have allocated enough space to reference array index 0 and 1. You should be able to reproduce this with a cross compiler without needing a cross assembler, library, etc.