Bug 2183668 - gcc outputs (presumably) incorrect warning/error while building gdb
Summary: gcc outputs (presumably) incorrect warning/error while building gdb
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 39
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-04-01 00:52 UTC by Kevin Buettner
Modified: 2023-08-16 08:08 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Kevin Buettner 2023-04-01 00:52:55 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Build Identifier: 

On Fedora 38 starting with gcc-13.0.1-0.6.fc38.x86_64 thru (at least) gcc-13.0.1-0.8.fc38.x86_64, I'm seeing a build error when building either gdb-13.1 (from Fedora) or upstream gdb.  I see the same problem on rawhide and have tested gcc versions up to gcc-13.0.1-0.11.fc39.x86_64. (At the time of testing, the build wasn't complete for all architectures, but it had completed for x86_64; I downloaded the necessary packages from koji and installed them by hand.)

On both Fedora 38 and rawhide, I did not see the build problem with gcc-13.0.1-0.5.

The build error that I'm seeing is:

g++ -x c++    -I. -I../../binutils-gdb/gdb -I../../binutils-gdb/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../binutils-gdb/gdb/../include/opcode -I../bfd -I../../binutils-gdb/gdb/../bfd -I../../binutils-gdb/gdb/../include -I../../binutils-gdb/gdb/../readline/readline/.. -I../../binutils-gdb/gdb/../zlib  -I../libdecnumber -I../../binutils-gdb/gdb/../libdecnumber  -I../../binutils-gdb/gdb/../gnulib/import -I../gnulib/import -I../../binutils-gdb/gdb/.. -I.. -I../../binutils-gdb/gdb/../libbacktrace/ -I../libbacktrace/ -DTUI=1    -I/usr/include/guile/2.2  -I/usr/include/python3.11 -I/usr/include/python3.11   -I../../binutils-gdb/gdb/.. -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 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer      -c -o init.o -MT init.o -MMD -MP -MF ./.deps/init.Tpo init.c
In file included from /usr/include/c++/13/bits/hashtable_policy.h:36,
                 from /usr/include/c++/13/bits/hashtable.h:35,
                 from /usr/include/c++/13/bits/unordered_map.h:33,
                 from /usr/include/c++/13/unordered_map:41,
                 from /usr/include/c++/13/functional:63,
                 from ../../binutils-gdb/gdb/../gdbsupport/ptid.h:35,
                 from ../../binutils-gdb/gdb/../gdbsupport/common-defs.h:206,
                 from ../../binutils-gdb/gdb/defs.h:26,
                 from ../../binutils-gdb/gdb/infcall.c:20:
In function ‘std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<value*, value*>(value**, value**, value**)value**’,
    inlined from ‘std::__copy_move_a2<false, value**, value**>(value**, value**, value**)value**’ at /usr/include/c++/13/bits/stl_algobase.h:506:30,
    inlined from ‘std::__copy_move_a1<false, value**, value**>(value**, value**, value**)value**’ at /usr/include/c++/13/bits/stl_algobase.h:533:42,
    inlined from ‘std::__copy_move_a<false, value**, value**>(value**, value**, value**)value**’ at /usr/include/c++/13/bits/stl_algobase.h:540:31,
    inlined from ‘std::copy<value**, value**>(value**, value**, value**)value**’ at /usr/include/c++/13/bits/stl_algobase.h:633:7,
    inlined from ‘std::__uninitialized_copy<true>::__uninit_copy<value**, value**>(value**, value**, value**)value**’ at /usr/include/c++/13/bits/stl_uninitialized.h:147:27,
    inlined from ‘std::uninitialized_copy<value**, value**>(value**, value**, value**)value**’ at /usr/include/c++/13/bits/stl_uninitialized.h:185:15,
    inlined from ‘std::__uninitialized_copy_a<value**, value**, value*>(value**, value**, value**, std::allocator<value*>&)value**’ at /usr/include/c++/13/bits/stl_uninitialized.h:373:37,
    inlined from ‘std::vector<value*, std::allocator<value*> >::_M_range_insert<value**>(__gnu_cxx::__normal_iterator<value**, std::vector<value*, std::allocator<value*> > >, value**, value**, std::forward_iterator_tag)void’ at /usr/include/c++/13/bits/vector.tcc:814:38,
    inlined from ‘std::vector<value*, std::allocator<value*> >::insert<value**, void>(__gnu_cxx::__normal_iterator<value* const*, std::vector<value*, std::allocator<value*> > >, value**, value**)__gnu_cxx::__normal_iterator<value**, std::vector<value*, std::allocator<value*> > >’ at /usr/include/c++/13/bits/stl_vector.h:1481:19,
    inlined from ‘call_function_by_hand_dummy(value*, type*, gdb::array_view<value*>, void (*)(void*, int), void*)’ at ../../binutils-gdb/gdb/infcall.c:1217:23:
/usr/include/c++/13/bits/stl_algobase.h:437:30: error: ‘memmove’ writing between 9 and 9223372036854775800 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
  437 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/x86_64-redhat-linux/bits/c++allocator.h:33,
                 from /usr/include/c++/13/bits/allocator.h:46,
                 from /usr/include/c++/13/bits/alloc_traits.h:39,
                 from /usr/include/c++/13/ext/alloc_traits.h:34,
                 from /usr/include/c++/13/bits/hashtable_policy.h:39:
In member function ‘std::__new_allocator<value*>::allocate(unsigned long, void const*)’,
    inlined from ‘std::allocator_traits<std::allocator<value*> >::allocate(std::allocator<value*>&, unsigned long)’ at /usr/include/c++/13/bits/alloc_traits.h:482:28,
    inlined from ‘std::_Vector_base<value*, std::allocator<value*> >::_M_allocate(unsigned long)’ at /usr/include/c++/13/bits/stl_vector.h:378:33,
    inlined from ‘std::_Vector_base<value*, std::allocator<value*> >::_M_allocate(unsigned long)’ at /usr/include/c++/13/bits/stl_vector.h:375:7,
    inlined from ‘std::vector<value*, std::allocator<value*> >::_M_range_insert<value**>(__gnu_cxx::__normal_iterator<value**, std::vector<value*, std::allocator<value*> > >, value**, value**, std::forward_iterator_tag)void’ at /usr/include/c++/13/bits/vector.tcc:805:40,
    inlined from ‘std::vector<value*, std::allocator<value*> >::insert<value**, void>(__gnu_cxx::__normal_iterator<value* const*, std::vector<value*, std::allocator<value*> > >, value**, value**)__gnu_cxx::__normal_iterator<value**, std::vector<value*, std::allocator<value*> > >’ at /usr/include/c++/13/bits/stl_vector.h:1481:19,
    inlined from ‘call_function_by_hand_dummy(value*, type*, gdb::array_view<value*>, void (*)(void*, int), void*)’ at ../../binutils-gdb/gdb/infcall.c:1217:23:
/usr/include/c++/13/bits/new_allocator.h:147:55: note: at offset [-9223372036854775808, -1] into destination object of size [8, 9223372036854775800] allocated by ‘operator new(unsigned long)’
  147 |         return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * sizeof(_Tp)));
      |                                                       ^
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:1920: infcall.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/tmp/build/gdb'


Reproducible: Always

Steps to Reproduce:
1.

cd /tmp

2.

git clone git://sourceware.org/git/binutils-gdb.git

3.

rm -rf build ; mkdir build ; cd build

4.

../binutils-gdb/configure --with-separate-debug-dir=/usr/lib/debug \
  --with-data-directory=/usr/share/gdb \
  --disable-{binutils,gas,ld,gprof,gold,sim} \
  CFLAGS="$(rpm --eval '%{build_cflags}')" \
  CXXFLAGS="$(rpm --eval '%{build_cxxflags}')" \
  LDFLAGS="$(rpm --eval '%{build_ldflags}')" \
  --enable-targets=s390-linux-gnu,powerpc-linux-gnu,arm-linux-gnu,aarch64-linux-gnu,amd64-linux-gnu

5.

V=1 make -j$(nproc)

(Due to use of the -j flag, you may have to scroll up to find the error/warning.)
Actual Results:  
Build does not complete successfully.  Error output is shown in "Details", above.

Expected Results:  
A successful build.  As noted earlier, I am able to get a successful build when using gcc-13.0.1-0.5 or by adding -Wno-stringop-overflow to CFLAGS and CXXFLAGS.  I'm currently using -Wno-stringop-overflow as a workaround for the Fedora gdb package on f38 and rawhide.

Comment 1 Fedora Release Engineering 2023-08-16 08:08:55 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.


Note You need to log in before you can comment on or make changes to this bug.