Bug 2183668 - gcc outputs (presumably) incorrect warning/error while building gdb
Summary: gcc outputs (presumably) incorrect warning/error while building gdb
Keywords:
Status: CLOSED EOL
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: 2024-11-27 21:10 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-11-27 21:10:14 UTC
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.

Comment 2 Aoife Moloney 2024-11-08 10:50:51 UTC
This message is a reminder that Fedora Linux 39 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 39 on 2024-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '39'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 39 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 3 Aoife Moloney 2024-11-27 21:10:14 UTC
Fedora Linux 39 entered end-of-life (EOL) status on 2024-11-26.

Fedora Linux 39 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


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