Array out of bounds

Tom de Vries tdevries@suse.de
Mon Sep 6 14:49:10 GMT 2021


On 9/6/21 12:24 PM, Tom de Vries via Gdb wrote:
> On 9/6/21 3:48 AM, Simon Marchi via Gdb wrote:
>>
>>
>> On 2021-09-05 2:06 p.m., Jan-Benedict Glaw wrote:
>>> Hi!
>>>
>>> On Sun, 2021-09-05 08:40:35 +0200, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
>>>> 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:
>>>
>>> Just to add: Seems to be independent of a target. Produces the same
>>> warning/error for all tested targets using a current GCC.
>>>
>>> Thanks,
>>>   Jan-Benedict
>>>
>>
>> I just built gcc at 66bba4dc263d ("Daily bump."), and I don't see it.
>>
> 
> I've managed to reproduce, filed as PR gcc/102216 - "False positive
> warray-bounds with -O2" @
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102216 .

FWIW, I've done a -Wno-array-bounds build at -O2 using the same gcc, and
that build succeeded.

Thanks,
- Tom

$ git diff
diff --git a/gdb/configure b/gdb/configure
index f0b1af4a6ea..410e69d09a1 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -16903,6 +16903,7 @@ build_warnings="-Wall -Wpointer-arith \
 -Wmissing-declarations \
 -Wmissing-prototypes \
 -Wstrict-null-sentinel \
+-Wno-array-bounds \
 "

 case "${host}" in
diff --git a/gdbserver/configure b/gdbserver/configure
index b227167e270..ca4b12adc76 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -9653,6 +9653,7 @@ build_warnings="-Wall -Wpointer-arith \
 -Wmissing-declarations \
 -Wmissing-prototypes \
 -Wstrict-null-sentinel \
+-Wno-array-bounds \
 "

 case "${host}" in
diff --git a/gdbsupport/configure b/gdbsupport/configure
index a9dd02c5b72..f39d1a794a2 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -10138,6 +10138,7 @@ build_warnings="-Wall -Wpointer-arith \
 -Wmissing-declarations \
 -Wmissing-prototypes \
 -Wstrict-null-sentinel \
+-Wno-array-bounds \
 "

 case "${host}" in
diff --git a/gdbsupport/warning.m4 b/gdbsupport/warning.m4
index 46036fa461e..f68e9cf3778 100644
--- a/gdbsupport/warning.m4
+++ b/gdbsupport/warning.m4
@@ -53,6 +53,7 @@ build_warnings="-Wall -Wpointer-arith \
 -Wmissing-declarations \
 -Wmissing-prototypes \
 -Wstrict-null-sentinel \
+-Wno-array-bounds \
 "

 case "${host}" in



More information about the Gdb mailing list