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

            Bug ID: 112091
           Summary: rs6000: redefinition of 'constexpr long double
                    std::abs(long double)', while building libgm2
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: build
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: macro at orcam dot me.uk
  Target Milestone: ---
            Target: powerpc64le-linux-gnu

As from commit 81d5ca0b9b84 ("PR 108143/modula2 LONGREAL and
powerpc64le-linux") target libgm2 fails building in a native
`powerpc64le-linux-gnu' bootstrap with system glibc 2.28:

cc1plus: warning: Using IEEE extended precision 'long double' [-Wpsabi]
In file included from
.../powerpc64le-linux-gnu/libstdc++-v3/include/cstdlib:81,
                 from
.../powerpc64le-linux-gnu/libstdc++-v3/include/stdlib.h:36,
                 from .../libgm2/libm2cor/KeyBoardLEDs.cc:43:
.../powerpc64le-linux-gnu/libstdc++-v3/include/bits/std_abs.h:137:3: error:
redefinition of 'constexpr long double std::abs(long double)'
  137 |   abs(__float128 __x)
      |   ^~~
.../powerpc64le-linux-gnu/libstdc++-v3/include/bits/std_abs.h:79:3: note:
'constexpr long double std::abs(long double)' previously defined here
   79 |   abs(long double __x)
      |   ^~~
make[5]: *** [Makefile:818: KeyBoardLEDs.lo] Error 1

This is apparently because with the `-mabi=ieeelongdouble' compilation
option used in this configuration we assume the redirection of the
`long double' data type to `__float128' and it is only supported by
glibc as from commit 051be01f6b41 ("powerpc64le: Enable support for IEEE
long double") or released version 2.32.

It is not clear to me what the correct solution to this issue would be
for glibc < 2.32, i.e. whether we ought to bail out gracefully such as
by disabling LONGREAL support, or even the frontend entirely, or whether
we could use explicit `__float128' data type rather than `long double'.
I guess in the latter case there might be ABI consequences, so it would
have to be considered carefully.  Input from someone more familiar with
the intricacies of the 64-bit POWER ABI might be desirable.

Relevant glibc mailing list discussion threads:
https://sourceware.org/pipermail/libc-alpha/2020-February/111092.html
https://sourceware.org/pipermail/libc-alpha/2020-March/112248.html
https://sourceware.org/pipermail/libc-alpha/2020-April/112579.html

Reply via email to