Bug 1912913 - gdb fails to build in Fedora rawhide
Summary: gdb fails to build in Fedora rawhide
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL: https://koschei.fedoraproject.org/pac...
Whiteboard:
Depends On:
Blocks: F34FTBFS PYTHON3.10 1913339 1926779
TreeView+ depends on / blocked
 
Reported: 2021-01-05 15:15 UTC by Miro Hrončok
Modified: 2021-02-11 23:26 UTC (History)
17 users (show)

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


Attachments (Terms of Use)
Test case showing problem with either g++ or libstdc++ (2.77 KB, text/x-csrc)
2021-01-06 21:25 UTC, Kevin Buettner
no flags Details


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 98465 0 P2 ASSIGNED Bogus -Wstringop-overread with -std=gnu++20 -O2 and std::string::insert 2021-02-17 23:46:30 UTC

Description Miro Hrončok 2021-01-05 15:15:42 UTC
Description of problem:
Package gdb fails to build from source in Fedora rawhide. This blocks our attempted Python 3.10 rebuilds.

Version-Release number of selected component (if applicable):
10.1-2.fc34

Steps to Reproduce:
fedpkg build

Additional info:
This package is tracked by Koschei. See:
https://koschei.fedoraproject.org/package/gdb

g++  -DHAVE_CONFIG_H -I. -I../../gdbsupport  -I../../gdbsupport/../include -I../../gdbsupport/../gdb -I../gnulib/import -I../../gdbsupport/../gnulib/import -I.. -I../../gdbsupport/..  -I../bfd -I../../gdbsupport/../bfd   -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 -Wno-unused -Werror -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -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  -MT netstuff.o -MD -MP -MF .deps/netstuff.Tpo -c -o netstuff.o ../../gdbsupport/netstuff.cc
In file included from /usr/include/c++/11/string:40,
                 from ../../gdbsupport/common-utils.h:23,
                 from ../../gdbsupport/common-defs.h:125,
                 from ../../gdbsupport/netstuff.cc:19:
In static member function 'static std::char_traits<char>::char_type* std::char_traits<char>::copy(std::char_traits<char>::char_type*, const char_type*, std::size_t)',
    inlined from 'static void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_S_copy(_CharT*, const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/11/bits/basic_string.h:351:21,
    inlined from 'static void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_S_copy(_CharT*, const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/11/bits/basic_string.h:346:7,
    inlined from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_replace(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/11/bits/basic_string.tcc:481:20,
    inlined from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::assign(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/11/bits/basic_string.h:1445:19,
    inlined from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/11/bits/basic_string.h:676:28,
    inlined from 'parsed_connection_spec parse_connection_spec_without_prefix(std::string, addrinfo*)' at ../../gdbsupport/netstuff.cc:109:20:
/usr/include/c++/11/bits/char_traits.h:402:56: error: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' reading 9 bytes from a region of size 1 [-Werror=stringop-overread]
  402 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
      |                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Comment 1 Kevin Buettner 2021-01-05 19:31:57 UTC
I'm able to reproduce this problem.

I think the actual bug is in some other package, but will do some more investigation further before reassigning it...

Comment 2 Kevin Buettner 2021-01-06 21:25:08 UTC
Created attachment 1745081 [details]
Test case showing problem with either g++ or libstdc++

I think that there is a bug in either g++ or libstdc++.

I was able to simplify the problematic file from the gdb sources to the attachment t.cc.

Instructions for compiling it are in the file (attachment), but I'll show it here as well.

Compile t.cc with the following command:

g++ -Werror -O2  -g -Wp,-D_GLIBCXX_ASSERTIONS -c t.cc

On f33, using gcc-c++-10.2.1-9.fc33.x86_64, it compiles without error.

However, on rawhide, using gcc-c++-11.0.0-0.11.fc34.x86_64, I see the following error:

[kevinb-fedora@rawhide-1 1912913]$ g++ -Werror -O2  -g -Wp,-D_GLIBCXX_ASSERTIONS -c t.cc
In file included from /usr/include/c++/11/string:40,
                 from t.cc:9:
In static member function ‘static std::char_traits<char>::char_type* std::char_traits<char>::copy(std::char_traits<char>::char_type*, const char_type*, std::size_t)’,
    inlined from ‘static void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_S_copy(_CharT*, const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at /usr/include/c++/11/bits/basic_string.h:351:21,
    inlined from ‘static void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_S_copy(_CharT*, const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at /usr/include/c++/11/bits/basic_string.h:346:7,
    inlined from ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_replace(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at /usr/include/c++/11/bits/basic_string.tcc:481:20,
    inlined from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::assign(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at /usr/include/c++/11/bits/basic_string.h:1445:19,
    inlined from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at /usr/include/c++/11/bits/basic_string.h:676:28,
    inlined from ‘std::string p()’ at t.cc:17:9:
/usr/include/c++/11/bits/char_traits.h:402:56: error: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ reading 9 bytes from a region of size 1 [-Werror=stringop-overread]
  402 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
      |                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Comment 3 Kevin Buettner 2021-01-06 21:27:27 UTC
I'm switching the component (package) to gcc.  I'm not positive that this is where the problem lies, but it seems like a good place to start.

Comment 4 Martin Sebor 2021-01-06 21:48:23 UTC
GCC PR 98465 tracks this warning: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98465

Comment 5 Kevin Buettner 2021-01-23 06:22:04 UTC
I've pushed a change to gdb's spec file which allows the gdb package to build again.  The release number has also been bumped (though not by me). That said, I have not made a new release because my testing shows a large number of regressions over the release built with an earlier version of gcc/g++.  I'm investigating those regressions now.

I'd prefer to keep this bug open until the gcc bug is fixed.  The spec file change mentioned above should be viewed as a workaround that should be kept in place only until gcc is fixed.

Comment 6 Fedora Release Engineering 2021-01-24 04:22:25 UTC
Dear Maintainer,

your package has an open Fails To Build From Source bug for Fedora 34.
Action is required from you.

If you can fix your package to build, perform a build in koji, and either create
an update in bodhi, or close this bug without creating an update, if updating is
not appropriate [1]. If you are working on a fix, set the status to ASSIGNED to
acknowledge this. If you have already fixed this issue, please close this Bugzilla report.

Following the policy for such packages [2], your package will be orphaned if
this bug remains in NEW state more than 8 weeks (not sooner than 2021-03-02).

A week before the mass branching of Fedora 35 according to the schedule [3],
any packages not successfully rebuilt at least on Fedora 33 will be
retired regardless of the status of this bug.

[1] https://docs.fedoraproject.org/en-US/fesco/Updates_Policy/
[2] https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/
[3] https://fedorapeople.org/groups/schedule/f-35/f-35-key-tasks.html

Comment 7 Ben Cotton 2021-02-09 15:37:03 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 8 Petr Menšík 2021-02-11 23:26:41 UTC
Similar warning appeared on kyua (bug #1926779), which is broken on several architectures since f34 rebuild. It might have also other issues, but this one also.


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