Bug 29198 - [Regression] specified bound 4294967295 may exceed maximum object size 2147483647
Summary: [Regression] specified bound 4294967295 may exceed maximum object size 214748...
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-30 19:11 UTC by John David Anglin
Modified: 2022-12-24 10:43 UTC (History)
2 users (show)

See Also:
Host: hppa*-*-linux*
Target: hppa*-*-linux*
Build: hppa*-*-linux*
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2022-05-30 19:11:52 UTC
The following compile error was introduced by commit 8839e3f3b0d1af5d93ba1d4f667ce33936bb7db2:

  CXX    debuginfod-support.o
In file included from /usr/include/c++/11/string:40,
                 from ../../src/gdb/../gdbsupport/ptid.h:36,
                 from ../../src/gdb/../gdbsupport/common-defs.h:198,
                 from ../../src/gdb/defs.h:28,
                 from ../../src/gdb/debuginfod-support.c:19:
In static member function 'static constexpr const char_type* std::char_traits<char>::find(const char_type*, std::size_t, const char_type&)',
    inlined from 'constexpr std::basic_string_view<_CharT, _Traits>::size_type std::basic_string_view<_CharT, _Traits>::find(_CharT, std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>]' at /usr/include/c++/11/bits/string_view.tcc:87:41,
    inlined from 'constexpr std::basic_string_view<_CharT, _Traits>::size_type std::basic_string_view<_CharT, _Traits>::find_first_of(_CharT, std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>]' at /usr/include/c++/11/string_view:431:26,
    inlined from 'bool debuginfod_is_enabled()' at ../../src/gdb/debuginfod-support.c:193:40:
/usr/include/c++/11/bits/char_traits.h:413:62: error: 'void* __builtin_memchr(const void*, int, unsigned int)' specified bound 4294967295 may exceed maximum object size 2147483647 [-Werror=stringop-overread]
  413 |         return static_cast<const char_type*>(__builtin_memchr(__s, __a, __n));
      |                                              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:1659: debuginfod-support.o] Error 1
make[2]: Leaving directory '/home/dave/gnu/binutils/objdir/gdb'
Comment 1 Mark Wielaard 2022-05-30 19:27:05 UTC
commit 716e54731f30bc60b2fc52996ebe4fc087420b2e
gdb: Workaround stringop-overread warning in debuginfod-support.c on s390x

commit 73a5cb257a21ad38c85932b7be4a903404d91899
gdb: Workaround stringop-overread warning in debuginfod-support.c on powerpc64

Maybe that fix should not be arch specific?
Comment 2 John David Anglin 2022-05-30 22:39:40 UTC
Might this be a gcc bug?
Comment 3 Mark Wielaard 2022-05-31 09:06:23 UTC
(In reply to John David Anglin from comment #2)
> Might this be a gcc bug?

Yes, I suspect it is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97185 where some range information is removed for some, but not all builtins causing the impossible warning message about the string size.

I proposed the following patch to just always suppress this diagnostic for now on all arches:
https://sourceware.org/pipermail/gdb-patches/2022-May/189603.html
Comment 4 Tom Tromey 2022-12-23 20:04:54 UTC
Is this fixed now?
Comment 5 dave.anglin 2022-12-23 21:26:51 UTC
On 2022-12-23 3:04 p.m., tromey at sourceware dot org wrote:
> https://sourceware.org/bugzilla/show_bug.cgi?id=29198
>
> --- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
> Is this fixed now?
The error no longer occurs but I'm not sure the underlying cause was fixed.
Comment 6 Mark Wielaard 2022-12-23 21:42:59 UTC
The patch to suppress this warning was pushed:

commit dac0515d825e788dec188fff4d5b9d4ac7383f33
Author: Mark Wielaard <mark@klomp.org>
Date:   Tue May 31 11:00:06 2022 +0200

    gdb: Always suppress stringop-overread warning in debuginfod-support.c
    
    Just like on s390x with g++ 11.2.1 and ppc64le with g++ 11.3.1 g++ 11
    on hppa produces a spurious warning for stringop-overread in
    debuginfod_is_enabled for url_view. Just always suppress it on all
    arches.
    
    https://sourceware.org/bugzilla/show_bug.cgi?id=29198
    
    gdb/ChangeLog:
    
            * debuginfod-support.c (debuginfod_is_enabled): Always use
            DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD.
Comment 7 Tom Tromey 2022-12-24 01:56:32 UTC
Ok, thanks.  I'm going to close this.

> The error no longer occurs but I'm not sure the underlying cause was fixed.

IIUC the underlying cause is a compiler bug, so I suppose
there ought to be an entry in the GCC bugzilla.
Comment 8 Mark Wielaard 2022-12-24 10:43:08 UTC
(In reply to Tom Tromey from comment #7)
> IIUC the underlying cause is a compiler bug, so I suppose
> there ought to be an entry in the GCC bugzilla.

That would be https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97185