Bug 2222188

Summary: glibc: GCC Toolset 13 enablement in installed headers
Product: Red Hat Enterprise Linux 9 Reporter: Florian Weimer <fweimer>
Component: glibcAssignee: Florian Weimer <fweimer>
Status: CLOSED ERRATA QA Contact: Sergey Kolosov <skolosov>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.3CC: ashankar, codonell, dj, fweimer, pfrankli, sipoyare, skolosov
Target Milestone: rcKeywords: Bugfix, Patch, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glibc-2.34-81.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:37:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Florian Weimer 2023-07-12 08:10:13 UTC
We have some installed header changes in upstream glibc to enable GCC 13. This commit in particular is concerning because it mentions fixincludes:

commit 3e5760fcb48528d48deeb60cb885a97bb731160c
Author: Joseph Myers <joseph>
Date:   Wed Sep 28 20:09:34 2022 +0000

    Update _FloatN header support for C++ in GCC 13
    
    GCC 13 adds support for _FloatN and _FloatNx types in C++, so breaking
    the installed glibc headers that assume such support is not present.
    GCC mostly works around this with fixincludes, but that doesn't help
    for building glibc and its tests (glibc doesn't itself contain C++
    code, but there's C++ code built for tests).  Update glibc's
    bits/floatn-common.h and bits/floatn.h headers to handle the GCC 13
    support directly.
    
    In general the changes match those made by fixincludes, though I think
    the ones in sysdeps/powerpc/bits/floatn.h, where the header tests
    __LDBL_MANT_DIG__ == 113 or uses #elif, wouldn't match the existing
    fixincludes patterns.
[…]

We cannot use fixincludes, so we probably should make these changes directly in the glibc headers.


To validate this change using GCC 13 and the glibc testsuite, we need to backport at least these additional commits:

commit f66780ba46805760a328f01967836416b06c93ca
Author: Joseph Myers <joseph>
Date:   Mon Oct 31 23:20:08 2022 +0000

    Fix build with GCC 13 _FloatN, _FloatNx built-in functions

commit 8a78f833d670f86302f2d0c32eb1e4357d9166ff
Author: Joseph Myers <joseph>
Date:   Fri Jan 6 19:33:29 2023 +0000

    C2x semantics for <tgmath.h>

commit d653fd2d9ebe23c2b16b76edf717c5dbd5ce9b77
Author: Florian Weimer <fweimer>
Date:   Thu Mar 10 08:50:51 2022 +0100

    malloc: Exit early on test failure in tst-realloc

commit 9cc9d61ee12f2f8620d8e0ea3c42af02bf07fe1e
Author: Florian Weimer <fweimer>
Date:   Fri Nov 4 18:37:16 2022 +0100

    elf: Disable some subtests of ifuncmain1, ifuncmain5 for !PIE

Comment 1 Florian Weimer 2023-07-12 09:44:01 UTC
It turns out that this GCC commit papers over the main issue:

commit 538a0d0f29b12cff05681b6de2e0a3d7b33f3ef0
Author: Jason Merrill <jason>
Date:   Mon Mar 13 14:06:11 2023 -0400

    c++: handle _FloatNN redeclaration like bool [PR107128]
    
    It's been inconvenient to compile testcases preprocessed with GCC 12 or
    earlier because they break on
    
      typedef __float128 _Float128;
    
    We already had code for handling this with bool and wchar_t, it just needs
    to be extended to _FloatNN as well.
    
            PR c++/107128
    
    gcc/cp/ChangeLog:
    
            * parser.cc (cp_parser_set_decl_spec_type): Use
            redefined_builtin_type for extended_float_type_p.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/warn/pragma-system_header6.h: New test.
            * g++.dg/warn/pragma-system_header6.C: New test.

Joseph's glibc commit mentions a problem with iseqsig (in the part I skipped), and that I can reproduce. This code:


#include <math.h>
void
f (_Float32 x, _Float32 y)
{
  iseqsig (x, y);
}

compiles with system GCC, GCC Toolset 12, but fails with GCC Toolset 13:

/usr/include/math.h:1392:38: error: incomplete type ‘__iseqsig_type<_Float32>’ used in nested name specifier
 1392 |   return __iseqsig_type<_T3>::__call (__x, __y);
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~

Comment 9 Florian Weimer 2023-08-14 06:26:55 UTC
For validation purposes, we need to backport one more commit:

commit c8126360dfa98024cc40bce915e126309993cdf9
Author: Joseph Myers <joseph>
Date:   Mon Aug 23 16:18:42 2021 +0000

    Fix iconv build with GCC mainline
    
    Current GCC mainline produces -Wstringop-overflow errors building some
    iconv converters, as discussed at
    <https://gcc.gnu.org/pipermail/gcc/2021-July/236943.html>.  Add an
    __builtin_unreachable call as suggested so that GCC can see the case
    that would involve a buffer overflow is unreachable; because the
    unreachability depends on valid conversion state being passed into the
    function from previous conversion steps, it's not something the
    compiler can reasonably deduce on its own.
    
    Tested with build-many-glibcs.py that, together with
    <https://sourceware.org/pipermail/libc-alpha/2021-August/130244.html>,
    it restores the glibc build for powerpc-linux-gnu.

Comment 17 errata-xmlrpc 2023-11-07 08:37:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (glibc bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6582