https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101977
Bug ID: 101977
Summary: array subscript 0 is outside array bounds
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: amodra at gmail dot com
Target Milestone: ---
Seen on attempting to build binutils for x86_64-linux with current mainline gcc
/home/alan/build/gcc-virgin/gcc/xgcc -B/home/alan/build/gcc-virgin/gcc/
-DHAVE_CONFIG_H -I. -I/home/alan/src/binutils-gdb/bfd
-DBINDIR=\"/usr/local/bin\" -DLIBDIR=\"/usr/local/lib\" -I.
-I/home/alan/src/binutils-gdb/bfd -I/home/alan/src/binutils-gdb/bfd/../include
-DHAVE_all_vecs -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow
-Wstack-usage=262144 -Werror -I/home/alan/src/binutils-gdb/bfd/../zlib -g -O2
-MT section.lo -MD -MP -MF .deps/section.Tpo -c
/home/alan/src/binutils-gdb/bfd/section.c -o section.o
In function ‘bfd_get_next_section_by_name’,
inlined from ‘bfd_get_linker_section’ at
/home/alan/src/binutils-gdb/bfd/section.c:976:11:
/home/alan/src/binutils-gdb/bfd/section.c:936:8: error: array subscript 0 is
outside array bounds of ‘asection[31160040665049918]’ {aka ‘struct
bfd_section[31160040665049918]’} [-Werror=array-bounds]
936 | hash = sh->root.hash;
| ~~~~~^~~~~~~~~~~~~~~