public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Array out of bounds
@ 2021-09-05  6:40 Jan-Benedict Glaw
  2021-09-05 18:06 ` Jan-Benedict Glaw
  0 siblings, 1 reply; 7+ messages in thread
From: Jan-Benedict Glaw @ 2021-09-05  6:40 UTC (permalink / raw)
  To: gdb

[-- Attachment #1: Type: text/plain, Size: 4673 bytes --]

Hi!

As I started with automated building/testing the GNU Toolchain again,
I found this when building GDB (make all-gdb) with a fairly recent GCC
on a Linux system (PC) when GDB is configured for
--target=aarch64-linux:

[all 2021-09-05 06:26:42] /usr/lib/gcc-snapshot/bin/g++ -x c++    -I. -I. -I./config -DLOCALEDIR="\"/tmp/gdb-aarch64-linux/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../readline/readline/.. -I./../zlib -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./../gnulib/import -I../gnulib/import -I./.. -I..  -DTUI=1    -I./.. -pthread  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized -Wno-mismatched-tags -Wsuggest-override -Wimplicit-fallthrough=3 -Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-copy-dtor -Wredundant-move -Wmissing-declarations -Wstrict-null-sentinel -Wformat -Wformat-nonliteral -Werror -g -O2   -c -o jit.o -MT jit.o -MMD -MP -MF ./.deps/jit.Tpo jit.c
[all 2021-09-05 06:26:53] /usr/lib/gcc-snapshot/bin/g++ -x c++    -I. -I. -I./config -DLOCALEDIR="\"/tmp/gdb-aarch64-linux/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../readline/readline/.. -I./../zlib -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./../gnulib/import -I../gnulib/import -I./.. -I..  -DTUI=1    -I./.. -pthread  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized -Wno-mismatched-tags -Wsuggest-override -Wimplicit-fallthrough=3 -Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-copy-dtor -Wredundant-move -Wmissing-declarations -Wstrict-null-sentinel -Wformat -Wformat-nonliteral -Werror -g -O2   -c -o language.o -MT language.o -MMD -MP -MF ./.deps/language.Tpo language.c
[all 2021-09-05 06:27:00] In file included from /usr/lib/gcc-snapshot/include/c++/12/functional:64,
[all 2021-09-05 06:27:00]                  from ./../gdbsupport/ptid.h:35,
[all 2021-09-05 06:27:00]                  from ./../gdbsupport/common-defs.h:198,
[all 2021-09-05 06:27:00]                  from defs.h:28,
[all 2021-09-05 06:27:00]                  from language.c:31:
[all 2021-09-05 06:27:00] In function 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = const char**; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const char*, const char*)>]',
[all 2021-09-05 06:27:00]     inlined from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = const char**; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const char*, const char*)>]' at /usr/lib/gcc-snapshot/include/c++/12/bits/stl_algo.h:1960:31,
[all 2021-09-05 06:27:00]     inlined from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = const char**; _Compare = bool (*)(const char*, const char*)]' at /usr/lib/gcc-snapshot/include/c++/12/bits/stl_algo.h:4868:18,
[all 2021-09-05 06:27:00]     inlined from 'void add_set_language_command()' at language.c:517:13,
[all 2021-09-05 06:27:00]     inlined from 'void _initialize_language()' at language.c:1203:28:
[all 2021-09-05 06:27:00] /usr/lib/gcc-snapshot/include/c++/12/bits/stl_algo.h:1869:32: error: array subscript 19 is outside array bounds of 'void [136]' [-Werror=array-bounds]
[all 2021-09-05 06:27:00]  1869 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
[all 2021-09-05 06:27:00]       |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[all 2021-09-05 06:27:00] In function 'void add_set_language_command()',
[all 2021-09-05 06:27:00]     inlined from 'void _initialize_language()' at language.c:1203:28:
[all 2021-09-05 06:27:00] language.c:499:78: note: at offset 152 into object of size 136 allocated by 'operator new []'
[all 2021-09-05 06:27:00]   499 |   language_names = new const char *[ARRAY_SIZE (language_defn::languages) + 2];
[all 2021-09-05 06:27:00]       |                                                                              ^
[all 2021-09-05 06:27:00] cc1plus: all warnings being treated as errors
[all 2021-09-05 06:27:00] make[1]: *** [Makefile:1643: language.o] Error 1
[all 2021-09-05 06:27:00] make[1]: Leaving directory '/var/lib/laminar/run/gdb-aarch64-linux/8/binutils-gdb/gdb'

Thanks,
  Jan-Benedict

-- 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-07 14:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-05  6:40 Array out of bounds Jan-Benedict Glaw
2021-09-05 18:06 ` Jan-Benedict Glaw
2021-09-06  1:48   ` Simon Marchi
2021-09-06  6:03     ` Jan-Benedict Glaw
2021-09-07 14:27       ` Simon Marchi
2021-09-06 10:24     ` Tom de Vries
2021-09-06 14:49       ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).