https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123374

            Bug ID: 123374
           Summary: elfutils: bogus warning when building debuginfod.cxx
                    since r16-5258
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: siddhesh at gcc dot gnu.org
  Target Milestone: ---

r16-5258 appears to have broken pointer-query, causing it to come up with bogus
ranges for some diagnostics in elfutils debuginfod.cxx:

In file included from /usr/include/features.h:540,
                 from /usr/include/libintl.h:23,
                 from ../lib/eu-config.h:34,
                 from ../config.h:241,
                 from debuginfod.cxx:32:
In function ‘read’,
    inlined from ‘extract_xz_blocks_into_fd(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, int, int,
lzma_index_iter*, unsigned long, unsigned long)’ at debuginfod.cxx:2324:37,
    inlined from
‘extract_from_seekable_archive(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, char*, unsigned long,
unsigned long)’ at debuginfod.cxx:2482:37,
    inlined from ‘handle_buildid_r_match(bool, long,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&, long, long, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, int*)’ at
debuginfod.cxx:2834:46:
/usr/include/bits/unistd.h:32:10: error: ‘*read’ specified size between
18446744069414588418 and 18446744073709551615 exceeds maximum object size
9223372036854775807 [-Werror=stringop-overflow=]
   32 |   return __glibc_fortify (read, __nbytes, sizeof (char),
      |          ^~~~~~~~~~~~~~~
debuginfod.cxx: In function ‘handle_buildid_r_match(bool, long,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&, long, long, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, int*)’:
debuginfod.cxx:2295:11: note: destination object allocated here
 2295 |   uint8_t in_buf[4096];
      |           ^~~~~~
/usr/include/bits/unistd-decl.h:29:16: note: in a call to function ‘*read’
declared with attribute ‘access (write_only, 2, 3)’
   29 | extern ssize_t __REDIRECT_FORTIFY (__read_alias, (int __fd, void
*__buf,
      |                ^~~~~~~~~~~~~~~~~~

Full log here:
https://download.copr.fedorainfracloud.org/results/siddhesh/mbp-gcc-16/fedora-rawhide-x86_64/09943681-elfutils/builder-live.log.gz

I've attached the preprocessed debuginfod.ii, compile with:

gcc -c -std=c++11 -Werror -O2 -Wall debuginfod.ii

Reply via email to